+ 2
How can i convert a string in toggle case?
3 Réponses
+ 3
Here's a method
import java.util.*;
String ToggleCase(String s, boolean b){
if (s.isEmpty())
return s;
char c = s.charAt(0);
if(b)
c = Character.toUpperCase(c);
else
c = Character.toLowerCase(c);
else
return (c+ToggleCase(s.substring(1),!b));
}
+ 1
جميل
0
hi