Here is what I have so far for my code..Please remember that this is a beg. java
ID: 3534955 • Letter: H
Question
Here is what I have so far for my code..Please remember that this is a beg. java class.
Just need help seperating the words so that I can capitalize the first letter. Please try to keep my code as much as possible.
Write a program that accepts a String and capitalizes the first letter of each word that
begins with a letter.
Use the methods of the Character class as much as you can, although you may have to
go to the String class for a couple of them.
{
public static void main (String[] args)
{
Scanner input=new Scanner(System.in);
String s1="this is my string";
int counter=0;
int where=0;
int howLong =s1.length();
while (counter<=howLong)
{
char c=s1.charAt(counter);
s1=s1.split(' ');
if(c==' ')
{
where = counter;
break;
}
else
{
c=Character.toUpperCase(c);
System.out.print(c);
}
counter++;
}
}
}
Explanation / Answer
//please rate
http://ideone.com/aGNtnU