Jump to content

Alduin768

Member
  • Content count

    2
  • Joined

  • Last visited

  1. Why does this give an error and how do I fix it? :confused: [CODE] public static String capitalizeString(String stringTo) { String newString = ""; //Converts the string to a CharArray char stringarray[] = stringTo.toCharArray(); //Sets the first letter of the CharArray to UpperCase //This line gives an error stringarray[0] = stringarray[0].toUpperCase(); //Converts the CharArray back to a String for (int i = 0; i < stringarray.length; i++) { newString = newString + stringarray[i]; } //Returns the newly capitalized string return newString; } [/CODE]
×