Help with functions

i think i see the same home work here last week,
did you use search here ( or google search ) already?

hope it helps: Calling a function for making a string lowercase without predefined function


possibly only the program flow,
while the rest looks good

void setup () {
  String str = "ABCD 123, Fall 2019, Pizza";
  println(str);
  String lowerStr = allLowercase(str);
  println(lowerStr);
}

String allLowercase(String str) {
  String res="";
  char c;
  for (int i = 0; i < str.length(); ++i) {
    c = str.charAt(i);
    if (c >= 'A' && c <= 'Z')  c=(char)(c+32);
    res = res+c;
  }
  return res;
}

1 Like