| | |
Converting lowercase to uppercase
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
Hey everyone,
I'm new at this.. so please bear with me.
Anyway, I'm really confused.
I'm supposed to convert the first character of the String firstName to upper case.
Problem is... I have no idea how to
I've done so much research and reading and still nothing.
Please help me.
Thanks in advance!
This is my code;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
char firstSymbol;
// First and Last Name
String firstName="mickey";
String lastName="mouse";
System.out.println(lastName + "," + firstName);
I'm new at this.. so please bear with me.
Anyway, I'm really confused.
I'm supposed to convert the first character of the String firstName to upper case.
Problem is... I have no idea how to
I've done so much research and reading and still nothing.
Please help me.
Thanks in advance!
This is my code;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
char firstSymbol;
// First and Last Name
String firstName="mickey";
String lastName="mouse";
System.out.println(lastName + "," + firstName);
Check out the java API: http://java.sun.com/j2se/1.4.2/docs/...Character.html
If you still can't figure it out let me know.
If you still can't figure it out let me know.
Last edited by WhYuLoOkIn; Feb 10th, 2008 at 10:54 pm.
Doing what they say couldn't be done!!!!
Well if you use the replace method you will have to hard code your code. Which is ok if you know what the string variable contains, In a case where you don't know, this will not be good. So It is probably good if you get familiar with the toUpperCase method in the Character class.
Here is an example how to use it:
Here is an example how to use it:
Java Syntax (Toggle Plain Text)
String unknown = " java"; //charAt gets the first character in string and upperCase converts it to uppercase //then I add the uppercase J to the rest of the String with substring starting at the second //character in the string java, so basically: J + ava -> Java unknown = Character.toUpperCase(unknown.charAt(0)) + unknown.substring(1);
Doing what they say couldn't be done!!!!
•
•
Join Date: Feb 2008
Posts: 7
Reputation:
Solved Threads: 0
Have you heard of unicode? In unicode each character has a corresponding number. A-Z corresponds with 65-90, while a-z corresponds with 97-122. In order to make the letter j into a capitol J you would convert the j into unicode, subtract 22, and convert back to letters, but I don't remember how to do it and I forgot to write it down in my notes LOL so just search around for unicode and it should help you.
PS I am a student and I just learned about this last week so if I'm wrong please feel free to correct me... I am trying to solve my own problems and thought I'd look around and see what else was here lol
PS I am a student and I just learned about this last week so if I'm wrong please feel free to correct me... I am trying to solve my own problems and thought I'd look around and see what else was here lol
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
Hi guys, converting uppercase or lowercase strings in java is so simple but if you wanna see a more complex application you can look at here...
There is a function that makes first letters of words, sentences or lines Uppercased in JAVA.
<URL SNIPPED>Uppercasing First Letters
This may be useful for learning more string operations.
There is a function that makes first letters of words, sentences or lines Uppercased in JAVA.
<URL SNIPPED>Uppercasing First Letters
This may be useful for learning more string operations.
Last edited by peter_budo; 14 Days Ago at 4:13 am. Reason: Keep It On The Site - Posts must contain actual content and substance and cannot simply be external links.
![]() |
Similar Threads
- StringUtil (Java)
- LC3 Uppercase and Lowercase (Assembly)
- Converting lowercase to capital (C)
- converting from char to ASCII to char (C++)
- Converting uppercase to lowercase help???? (Java)
- Converting from lower case and uppercase (C)
- Converting lowercase type to uppercase (new programmer) (Java)
- Convert first character from lowercase to uppercase? (C)
Other Threads in the Java Forum
- Previous Thread: Converting String of user entered numbers into array of integers
- Next Thread: Gap Sort
| Thread Tools | Search this Thread |
-xlint add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class client code compile compiler component database development digit eclipse equation error event fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login loop main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver string superclass swing system text-file thread threads tree variablebinding windows xor





