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


150

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

例如:

“苹果”更改为“乐”  
“一只猫”改为“在”  
'ab c'更改为'bc'

7
您应该学习JavaString基础。
哈里·乔伊,


提出问题之前,请先搜索SO。肯定已经问过这样一个基本问题。
james.garriss 2014年

但是不知何故,它仍然获得了150多个投票,而答案为345+。好问题!
DORRITO

Answers:



9

使用String类的子字符串方法:
string.substring(3);


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.