FearFactor_x
asked on
Converting a String arry of CAPS to Init Caps
hi Experts,
What is the most efficient way to convert a string Array of all CAPS to init Caps..That is the first letter of each word {greater than 3 Characters ..} is capitalised But the starting alphabet of the stirng is always capitalixed.. irrepective of whether it is 3 characters long or not.... For example..
1) I AM THE STRING WHICH IS TO BE CAPITALIZED..
should be converted into
Output : I am the String Which is to be Capitalized.
What is the most efficient way to do this..
Pls give me the most efficient way to approach this .
Thanx in Advance.
Regards,
newBie Programmer
What is the most efficient way to convert a string Array of all CAPS to init Caps..That is the first letter of each word {greater than 3 Characters ..} is capitalised But the starting alphabet of the stirng is always capitalixed.. irrepective of whether it is 3 characters long or not.... For example..
1) I AM THE STRING WHICH IS TO BE CAPITALIZED..
should be converted into
Output : I am the String Which is to be Capitalized.
What is the most efficient way to do this..
Pls give me the most efficient way to approach this .
Thanx in Advance.
Regards,
newBie Programmer
That was from https://www.experts-exchange.com/questions/10235434/Converting-Strings-to-Title-case.html
There is also a class in the Apache Commons libraries to do this... TextUtils class I think (but I can't be 100% sure)
There is also a class in the Apache Commons libraries to do this... TextUtils class I think (but I can't be 100% sure)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops:
System.out.println(ret);
System.out.println(ret);
StringBuffer s=new StringBuffer(tgt.toLowerCa
boolean raise=true;
for(int i=0; i<s.length(); ++i)
{ if(raise && !Character.isSpace(s.charA
{ s.setCharAt(i,Character.to
raise=false;
}
else if(!raise && Character.isSpace(s.charAt
{ raise=true;
}
}
String ns=new String(s);