gOOGLE cASE of a given sentence | Java program to convert given sentence to camel case . ; Function to remove spaces and convert into camel case ; check for spaces in the sentence ; conversion into upper case ; If not space , copy character ; return string to main ; Driver code
import java . io . * ; class GFG { static String convert ( String s ) { int n = s . length ( ) ; String s1 = " " ; s1 = s1 + Character . toLowerCase ( s . charAt ( 0 ) ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' ▁ ' && i < n ) { s1 = s1 + " ▁ " + Character . toLowerCase ( s . charAt ( i + 1 ) ) ; i ++ ; } else s1 = s1 + Character . toUpperCase ( s . charAt ( i ) ) ; } return s1 ; } public static void main ( String [ ] args ) { String str = " I ▁ get ▁ intern ▁ at ▁ geeksforgeeks " ; System . out . println ( convert ( str ) ) ; } }