forum

Home / DeveloperSection / Forums / charAt() and substring method in java

charAt() and substring method in java

Anonymous User211610-Oct-2014
I want to go through each character in a String and pass each character of the String as a String to another function.
String s = "abcdefg";
for (int i = 0; i < s.length(); i++)
{
      newFunction(s.substring(i, i + 1));
}

or

String s = "abcdefg";
for (int i = 0; i < s.length(); i++)
{
       newFunction(Character.toString(s.charAt(i)));
}


Updated on 10-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By