String characters count in Java
Forums:
String Reverse(String word) {
//Characters count
int charCount = word.length();
String result = "";
for (int i = charCount - 1; i >= 0; i--)
{
result += word.charAt(i);
}
return result;
}
String stringReverse = Reverse("string");
//stringReverse = "gnirts"
- Log in to post comments