Results 1 to 17 of 17
- 05-20-2007, 08:40 PM #1
Member
- Join Date
- May 2007
- Posts
- 10
- Rep Power
- 0
- 05-20-2007, 08:43 PM #2levent Guest
Hi Valeriano,
You can use toUpperCase() method of String class. String class has lots of more useful methods.
- 06-28-2007, 05:45 AM #3
Member
- Join Date
- Jun 2007
- Posts
- 3
- Rep Power
- 0
String s1 = "test";
s1 = s1.toUpperCase();
System.out.println(""=========RESULT=========" + s1);
//it'll print TEST
- 02-13-2009, 10:16 AM #4
Member
- Join Date
- Feb 2009
- Posts
- 22
- Rep Power
- 0
Try this
private String conertToTitleCase(String actualName) {
StringBuilder name = new StringBuilder(actualName);
name.setCharAt(0, (char)(name.charAt(0) -32));
for(int i = 1 ; i < name.length() ; i++){
if(name.charAt(i -1) == ' ' && name.charAt(i) != ' '){
name.setCharAt(i, (char)(name.charAt(i) -32));
}
}
return name.toString();
}
- 02-13-2009, 11:09 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Why you want to do the conversion in such a long way?
- 02-13-2009, 11:22 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 02-13-2009, 11:45 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-13-2009, 08:06 PM #8
Member
- Join Date
- Jan 2008
- Posts
- 31
- Rep Power
- 0
I saved this thinking one day I might need it (and I was right, look like today is the day)
it works in C/C++ have not used it in java
uppercase = lowercase – ('a' – 'A');
lowercase = uppercase + ('a' – 'A');
- 02-13-2009, 08:40 PM #9
hhhmmm...
huh... "uppercase" and "lowercase" are string variables?
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-13-2009, 08:49 PM #10
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
i'd assume chars.
- 02-13-2009, 09:11 PM #11
ah!! yes... duh... got it... thanks !
... and yeah, it works if you do some casting:
But I think it will only support US ASCII.uppercase = (char)(lowercase - ('a' - 'A'));
lowercase = (char)(uppercase + ('a' - 'A'));
CJSLLast edited by CJSLMAN; 02-13-2009 at 09:41 PM.
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-13-2009, 09:52 PM #12
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 02-14-2009, 12:01 AM #13
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
zombieeee thread.
- 02-14-2009, 12:31 AM #14
hahaha.... didn't even notice... well, at least it was fun !!! I don't feel so bad because it seems everybody really into it...
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 12-03-2009, 12:28 PM #15
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,423
- Blog Entries
- 7
- Rep Power
- 17
Please stop double posting and stick to your own thread.
kind regards,
Jos
- 03-01-2010, 06:13 AM #16
Member
- Join Date
- Mar 2010
- Posts
- 1
- Rep Power
- 0
You can use method...
String toUpperCase( word you want to move to upper case goes in this area);
then it will move all the words to upper case..
I think this link below may help you about these stuffs.
String (Java 2 Platform SE 5.0)
Best regards
Thank You !
-
Similar Threads
-
String Title case
By bugger in forum New To JavaReplies: 6Last Post: 01-31-2012, 01:21 PM -
How to convert a string into a BigInteger
By valery in forum New To JavaReplies: 4Last Post: 09-13-2011, 01:32 PM -
String manipulation example (Title case)
By Java Tip in forum Java TipReplies: 0Last Post: 01-29-2008, 09:04 AM -
convert string to a double?
By javaMike in forum Advanced JavaReplies: 2Last Post: 11-27-2007, 03:10 AM -
convert string to float
By miss_dot in forum NetBeansReplies: 1Last Post: 11-14-2007, 11:26 PM


LinkBack URL
About LinkBacks


Bookmarks