如何将字符串从“Bobs big barbeque”之类的字符串转换为 bobsBigBarbeque?
String variableName = result;
for ( int i = 0; i < result.length( ); i++ ) {
char c = result.charAt( i );
if ( c == ' ' ) {
Character.toUpperCase( variableName.charAt( result.indexOf( c )+1 ) );
}
variableName = variableName.replace( " ", "" );
Character.toLowerCase( variableName.charAt( 0 ) );
System.out.println( variableName );
}
我几乎让它工作了。我现在唯一的问题是线路....
Character.toLowerCase( variableName.charAt( 0 ) );
我必须将第一个字符转换为小写