Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String capitalize(String stringa) {
- int i = 0;
- String comodo= null;
- String s= null;
- StringBuilder uppercase = null;
- int n= stringa.length();
- s = stringa.substring(0,1).toUpperCase()+stringa.substring(1,n).toLowerCase();
- for (i = 0; i < s.length(); i++) {
- if (s.charAt(i)==' ' && i < s.length()-1) {
- comodo = s.substring(i+1, i+2).toUpperCase();
- uppercase = new StringBuilder(s);
- uppercase.replace(i+1, i+2,comodo);
- s = uppercase.toString();
- }
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement