changing the uppercase letters to lowercase and visa versa in a string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkk572ny
    New Member
    • Mar 2008
    • 3

    changing the uppercase letters to lowercase and visa versa in a string

    Hi, I was wondering if anyone could help me to create a java method to changing the uppercase letters to lowercase and visa versa in a string using a for-loop. Thanks.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Well, there are already some functions in the String class that do this...like toLowerCase() and toUpperCase() ...

    But if you must write your own, you can use a for loop and the replace() method, along with Character.java's toLowerCase(cha r) or toUpperCase(cha r), to replace every lowercase letter with its uppercase equivalent (or vice versa).

    Comment

    Working...