Results 1 to 3 of 3
  1. #1
    glockner is offline Member
    Join Date
    Jan 2015
    Posts
    31
    Rep Power
    0

    Default Parameter to lower case?

    I am trying to take the parameter given and convert it into lowercase if need be so I can see if the state or city contains the sequence of letters that were given by the user.

    Java Code:
        public ArrayList <Customer> getMailingList(String keyword){
            ArrayList <Customer> key = new ArrayList<Customer>();
            keyword = keyword.toLowerCase;
            for(Customer c : data){
                if(c.getState().contains(keyword)|| c.getCity().contains(keyword))
                    key.add(c);
            }
            return key;
        }

  2. #2
    glockner is offline Member
    Join Date
    Jan 2015
    Posts
    31
    Rep Power
    0

    Default Re: Parameter to lower case?

    Never mind figured it out it needed to be

    Java Code:
    keyword = keyword.toLowerCase();

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Parameter to lower case?

    I hope you figured it out by finding and looking at the API documentation of the String class. Always the first place to look when you want to do something or another with a String.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 11
    Last Post: 06-19-2013, 09:45 AM
  2. Making string insensitive to upper or lower case
    By ahmedaa16 in forum New To Java
    Replies: 0
    Last Post: 10-21-2011, 12:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •