Calling a function for making a string lowercase without predefined function

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.

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();
  }
}
1 Like

your function should return something

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

Not sure about this, try < instead

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