从字符串中删除前3个字符

时间:2022-01-30 17:08:52

What is the most efficient way to remove the first 3 characters of a string?

删除字符串前3个字符的最有效方法是什么?

For example:

例如:

'apple' change to 'le'  
'a cat' change to 'at'  
' a b c'change to 'b c'

3 个解决方案

#1


222  

Just use substring: "apple".substring(3); will return le

只需使用substring:“apple”.substring(3);将返回le

#2


8  

Use substring method of String class :
string.substring(3);

使用String类的substring方法:string.substring(3);

#3


6  

Use the substring method of the String class :

使用String类的substring方法:

String removeCurrency=amount.getText().toString().substring(3);

#1


222  

Just use substring: "apple".substring(3); will return le

只需使用substring:“apple”.substring(3);将返回le

#2


8  

Use substring method of String class :
string.substring(3);

使用String类的substring方法:string.substring(3);

#3


6  

Use the substring method of the String class :

使用String类的substring方法:

String removeCurrency=amount.getText().toString().substring(3);