String-type String to remove space data type conversion (String to int), stringint
// Initial string
String a = "1 2 3 4 5 ";
System. out. println ("string:" + );
System. out. println ();
// Use the trim method of String to remove the String with spaces at the beginning
String B = a. trim (); // trim spaces at the beginning and end of the trim () function
System. out. println ("Remove the beginning:" + B );
System. out. println ();
// Replace all spaces with the String replace Method
// ReplaceAll replaces all replaceFirst
String c = a. replaceAll ("", ""); // replace all spaces in the String with replace
System. out. println ("Remove all spaces:" + c );
// Use the String replace method to replace the String with spaces
String d = a. replaceFirst ("", ""); // replace the space at the beginning of the String with replace
System. out. println ("Remove the beginning:" + d );
System. out. println ();
// Convert String to int
Int I = Integer. parseInt (c );
System. out. println ("int type:" + I );
System. out. println ();
// String to int post-Multiplication
Int j = I * 2;
System. out. println ("multiply by 2:" + j );