Java Program to toggle the case of string

Java Program to toggle the case of string

class toggle{

public static void main(String args[]){

for(int i=0; i<args[0].length(); i++){

if(Character.isUpperCase(args[0].charAt(i)))

System.out.print(Character.toLow

erCase(args[0].charAt(i)));

else if(Character.isLowerCase(args[0].charAt(i)))

System.out.print(Character.toUpperCase(args[0].charAt(i)));

else

System.out.print(args[0].charAt(i));

}

}

}Rich Text AreaToolbarBold (Ctrl + B)Italic (Ctrl + I)Strikethrough (Alt + Shift + D)Unordered list (Alt + Shift + U)Ordered list (Alt + Shift + O)Blockquote (Alt + Shift + Q)Align Left (Alt + Shift + L)Align Center (Alt + Shift + C)Align Right (Alt + Shift + R)Insert/edit link (Alt + Shift + A)Unlink (Alt + Shift + S)Insert More Tag (Alt + Shift + T)Toggle spellchecker (Alt + Shift + N)▼
Toggle fullscreen mode (Alt + Shift + G)Show/Hide Kitchen Sink (Alt + Shift + Z)
FormatFormat▼
UnderlineAlign Full (Alt + Shift + J)Select text color▼
Paste as Plain TextPaste from WordRemove formattingInsert custom characterOutdentIndentUndo (Ctrl + Z)Redo (Ctrl + Y)Help (Alt + Shift + H)

Java Program to toggle the case of string
class toggle{
public static void main(String args[]){
for(int i=0; i<args[0].length(); i++){
if(Character.isUpperCase(args[0].charAt(i)))
System.out.print(Character.toLowerCase(args[0].charAt(i)));
else if(Character.isLowerCase(args[0].charAt(i)))
System.out.print(Character.toUpperCase(args[0].charAt(i)));
else
System.out.print(args[0].charAt(i));
}
}
}
Path:

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.