+2

How can i convert a string in toggle case?

8/21/2019 9:26:21 AM

Piyush Srivastava

3 Answers

New Answer

+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

+1