# Calling a function for making a string lowercase without predefined function

**URL:** <https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775>\
**Category:** Coding Questions\
**Created:** [October 18, 2019, 2:06am UTC](https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775 "2019-10-18T02:06:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcusshin](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@marcusshin](https://discourse.processing.org/u/marcusshin)\
**Post date:** [October 18, 2019, 2:06am UTC](https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775/1 "2019-10-18T02:06:24Z")

</div>

Hello! I am currently stuck in a programming practice question where I am required to call a function for converting all uppercase strings into lowercase without using the toLowercase() predefined function. If you could tell me what I am doing wrong in my code, I’d be really thankful!

PS. I am currently learning processing with 0 coding experience.

```auto
void setup () 
{
 String str = "ENGG 233, Fall 2019, UCalgary";
 String lowerStr = allLowercase (str);
 println(lowerStr);
}

String allLowercase(String k)
{
  for (int i = 0; i <= k.length(); i++)
  {
    if (k.charAt(i) >= 65 && k.charAt(i) <= 90)
    {
      print(k.charAt(i)+32);
    }
    println();
  }
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [October 18, 2019, 5:22am UTC](https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775/2 "2019-10-18T05:22:41Z")

</div>

your function should return something

```auto
String allLowercase(String in) {
  String out = "";
// for test  
  out = in;
//...
  return out;
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 18, 2019, 11:49am UTC](https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775/3 "2019-10-18T11:49:37Z")

</div>

> [@marcusshin](#):
>
> i \<= k.length()

Not sure about this, try \< instead

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 18, 2019, 11:51am UTC](https://discourse.processing.org/t/calling-a-function-for-making-a-string-lowercase-without-predefined-function/14775/4 "2019-10-18T11:51:31Z")

</div>

> [@marcusshin](#):
>
> print(k.charAt(i)+32);

You need to change a variable („out“ as kll suggested) and assign it the letters instead of only print them
