converting to upper case

what is the way to convert just one letter of a string to uppercase? for eg: if i have a string "welcome" and i need the output "weLcome", how can i get it?
[163 byte] By [chinchuyeldoa] at [2007-11-27 7:58:57]
# 1
Since you can't modify a String, you'll need a StringBuffer or StringBuilder. And also look at the Character class.
CeciNEstPasUnProgrammeura at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 2

You could use this:

public String toUpperCase(String input)

{

char[] array = input.toCharArray();

array[2] = Character.toUpperCase(array[2]);

input = new String(array);

return input;

}

The value 2 would be the position of the character which you would like to make upper case.

Message was edited by:

ita6cgr

ita6cgra at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 3
pass string to upper string functioncharector positiontoUpperCase( char_position)
sandeep_2012a at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 4
... and if your name is Harry Potter, this might even work.
quittea at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 5
> ... and if your name is Harry Potter, this might even> work.Give the guy a break. By the looks of his name, he's from the future, where perhaps this API call now exists :)
georgemca at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 6
Hey! thanks for that tip. it is working..
chinchuyeldoa at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 7
thanks to the person who gave me that method of converting to char array.. it is working..
chinchuyeldoa at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 8
No problem. :-)
ita6cgra at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 9
And I thought it was the voice of future which helped ...:^)
quittea at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 10
> And I thought it was the voice of future which helped> ...> > :^)**** I got my hopes up there... Thought I'd helped someone!!! ;-)
ita6cgra at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...
# 11
Does hairy pothead have his own Java compiler out or something? Let me guess it's up to release 4... Hairy Pothead and The Prisoner of Infinite Recursion.;-) Keith.
corlettka at 2007-7-12 19:40:55 > top of Java-index,Java Essentials,Java Programming...