Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: wanting to convert printout to UPPER case

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default wanting to convert printout to UPPER case

    import java.util.*;
    import java.io.File;
     
    class assignment1{
     
    	public static void main (String[] args) throws Exception{
     
    		File alicefile = new File("alice.txt");
    		Scanner scan = new Scanner (alicefile);
    		String text;
     
    		for (int linenumber = 1; linenumber <= 20; linenumber++) //condition
    		{
    			text = scan.nextLine();
    			System.out.println(text);
     
    		}//end of loop block
     
    		scan.close();
     
    	}//end of method block
    }//end of class block

    this is what i have so far to read first 20 lines of text from a file. i now want to convert all printout to UPPER case. how would i do this. Thanks scott


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: wanting to convert printout to UPPER case

    What have you tried? Check out the String API for useful methods.

    String (Java Platform SE 6)

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: wanting to convert printout to UPPER case

    text = text.toUpperCase();

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: wanting to convert printout to UPPER case

    Quote Originally Posted by welikedogs View Post
    text = text.toUpperCase();
    Did that work? Or did you have another question?

  5. #5
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: wanting to convert printout to UPPER case

    did you have another question?
    Like GimmeTehCodez™?

    db

Similar Threads

  1. Convert DOC,XLS to PDF with Java
    By comm in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: July 2nd, 2013, 04:10 AM
  2. Um, ya, wanting to do a little more than my program can take
    By aussiemcgr in forum Java Theory & Questions
    Replies: 5
    Last Post: September 3rd, 2010, 04:36 PM
  3. [SOLVED] upper case
    By andaji in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 13th, 2010, 11:54 PM
  4. Conversion of string into integer in Java
    By JavaPF in forum Java Programming Tutorials
    Replies: 17
    Last Post: January 23rd, 2010, 09:33 AM
  5. convert GSM to PCM (wav)
    By cilang in forum Java Theory & Questions
    Replies: 4
    Last Post: August 7th, 2009, 03:46 AM