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 8 of 8

Thread: Ignoring cases

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ignoring cases

    nevermind i figured it out
    Last edited by noel222; February 11th, 2012 at 06:52 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Ignoring cases

    Read the API doc for the String class. There are many methods there that will be useful to you.
    Java Platform SE 6

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Ignoring cases

    Can you recommend anything. I know how to make the string all lowercase. It is just that I don't know how to tell the program to accept the all lowercase answer as correct

  4. #4
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Ignoring cases

    Click on norms link, Ctrl F and search for 'case', and cycle through the results.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  5. #5
    Junior Member
    Join Date
    Jan 2012
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Ignoring cases

    nevermind i figured it out
    Last edited by noel222; February 11th, 2012 at 06:52 PM.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Ignoring cases

    I know how to make the string all lowercase, I am having a problem telling the program to accept it. This is what I have, can somebody PLEASE tell me what I am doing wrong.
    public boolean isRightPlayer(String player, String Nickname) {
    boolean isRightPlayer = false;

    if (player == player.toLowerCase() && nickname == nickname.toLowerCase())
    isRightPlayer = true;

    return isRightPlayer;
    }
    If you'll explain what that method is supposed to do, maybe someone can tell you what it does.

    One quick way to find out is to test it. Call it with many different types of Strings and observe the results and see if they are what you want.

  7. #7
    Junior Member
    Join Date
    Jan 2012
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Ignoring cases

    nevermind i figured it out
    Last edited by noel222; February 11th, 2012 at 06:53 PM.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Ignoring cases

    private static void Correctly() {
    		setup();
    		if (!team.isRightPlayer("KeiTh SMITH", "hammer"))
    			System.out.println("Incorrectly case-rejected show: Keith");
    		if (!team.isRightNickname("HAMMER", "kEItH smith"))
    			System.out.println("Incorrectly case-rejected star: Keith");
    can't get the code to see that the two names are the same
    Please show some examples. Something like:
    System.out.println("test1: " + team.isRightPlayer("KeiTh SMITH", "hammer"));
    Then post the results and explain which should be true and which should be false

    Can you answer these questions about the isRightPlayer() method
    It will return true if ....
    It will return false if ....

    replace the ... with the condition(s) that describe when that value will be returned

Similar Threads

  1. Referring to cases
    By colerelm in forum Java Theory & Questions
    Replies: 2
    Last Post: December 4th, 2011, 07:41 AM
  2. Switching letter-cases from user input; why is not working?
    By Kimiko Sakaki in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 27th, 2011, 07:48 AM
  3. Converting Cases Help
    By Bradshjo in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 27th, 2010, 12:07 PM
  4. Are We seriously Ignoring NetBeans?
    By javacrazed in forum Java IDEs
    Replies: 4
    Last Post: November 12th, 2008, 05:08 PM