[Java]
Package com. yunos. account. controller. api;
Import org. apache. commons. lang. StringUtils;
Public class Test {
Public static void main (String [] args ){
String str = "Hello World ";
/* Truncate the string substring */
String string1 = str. substring (5, 10 );
System. out. println (string1 );
/* Connection string concat */
String concatString = "Yes ";
String string2 = concatString. concat (str );
System. out. println (string2 );
/* Replace the string */
String string3 = str. replace ("Hello", "123 ");
System. out. println (string3 );
/* Remove spaces at the beginning and end of trim */
String string4 = "TRIM". trim ();
System. out. println (string4 );
/* Convert to lowercase toLowerCase */
String string5 = "ASODOIASODI". toLowerCase ();
System. out. println (string5 );
/* Convert to uppercase toUpperCase */
String string6 = "asdasdasd". toUpperCase ();
System. out. println (string6 );
/* String length */
Int len = "asdasdasd". length ();
System. out. println (len );
/* Extract a character charAt */
Char ch = "asdasdasd". charAt (6 );
System. out. println (ch );
/* Bytes */
String string7 = "Hello! Hello! ";
Byte [] bytes = string7.getBytes ();
System. out. println (bytes );
/* String to character array */
String string8 = "Hello! Hello! ";
Char [] chs = string8.toCharArray ();
System. out. println (chs. toString ());
/* String comparison function */
If (! Str. equals ("1111 ")){
System. out. println ("different strings ");
}
/* Whether to start with a specific character */
If (str. startsWith ("Hello ")){
System. out. println ("starting with Hello ");
}
/* Whether to end with a specific character */
If (str. endsWith ("World ")){
System. out. println ("end with World ");
}
/* Find the location where the character appears */
Int ddd = str. indexOf ("W ");
System. out. println (ddd );
/* Check whether the string is null """"*/
If (StringUtils. isBlank (str )){
System. out. println ("null ");
}
/* Check that the string is not null. null """"*/
If (StringUtils. isNotBlank (str )){
System. out. println ("null ");
}
/* Check whether the string is null and "" */
If (StringUtils. isEmpty (str )){
System. out. println ("null ");
}
/* Check whether the string is null or "" */
If (StringUtils. isNotEmpty (str )){
System. out. println ("null ");
}
}
}
Package com. yunos. account. controller. api;
Import org. apache. commons. lang. StringUtils;
Public class Test {
Public static void main (String [] args ){
String str = "Hello World ";
/* Truncate the string substring */
String string1 = str. substring (5, 10 );
System. out. println (string1 );
/* Connection string concat */
String concatString = "Yes ";
String string2 = concatString. concat (str );
System. out. println (string2 );
/* Replace the string */
String string3 = str. replace ("Hello", "123 ");
System. out. println (string3 );
/* Remove spaces at the beginning and end of trim */
String string4 = "TRIM". trim ();
System. out. println (string4 );
/* Convert to lowercase toLowerCase */
String string5 = "ASODOIASODI". toLowerCase ();
System. out. println (string5 );
/* Convert to uppercase toUpperCase */
String string6 = "asdasdasd". toUpperCase ();
System. out. println (string6 );
/* String length */
Int len = "asdasdasd". length ();
System. out. println (len );
/* Extract a character charAt */
Char ch = "asdasdasd". charAt (6 );
System. out. println (ch );
/* Bytes */
String string7 = "Hello! Hello! ";
Byte [] bytes = string7.getBytes ();
System. out. println (bytes );
/* String to character array */
String string8 = "Hello! Hello! ";
Char [] chs = string8.toCharArray ();
System. out. println (chs. toString ());
/* String comparison function */
If (! Str. equals ("1111 ")){
System. out. println ("different strings ");
}
/* Whether to start with a specific character */
If (str. startsWith ("Hello ")){
System. out. println ("starting with Hello ");
}
/* Whether to end with a specific character */
If (str. endsWith ("World ")){
System. out. println ("end with World ");
}
/* Find the location where the character appears */
Int ddd = str. indexOf ("W ");
System. out. println (ddd );
/* Check whether the string is null """"*/
If (StringUtils. isBlank (str )){
System. out. println ("null ");
}
/* Check that the string is not null. null """"*/
If (StringUtils. isNotBlank (str )){
System. out. println ("null ");
}
/* Check whether the string is null and "" */
If (StringUtils. isEmpty (str )){
System. out. println ("null ");
}
/* Check whether the string is null or "" */
If (StringUtils. isNotEmpty (str )){
System. out. println ("null ");
}
}
}