从字符串中删除前 3 个字符 [已关闭]

2022-08-31 06:33:17

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

例如:

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

答案 1

只需使用子字符串:将返回"apple".substring(3);le


答案 2

使用 String 类的子字符串方法:

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