Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CamelTyping{
- public static void main(String[] args){
- String input = "thank you for visiting my pastebin!";
- String camel = "";
- for(int i = 0; i < input.length(); i++){
- if(i==0 || input.charAt(i-1)==' ') camel+=Character.toUpperCase(input.charAt(i));
- else if(input.charAt(i)==' ') continue; //comment out this line if you want spaces
- else camel+=input.charAt(i);
- }
- System.out.print(camel);
- }
- }
- //Output:-
- //ThankYouForVisitingMyPastebin!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement