Java - 删除字符串的第一个字符 [英] Java - removing first character of a string
本文介绍了Java - 删除字符串的第一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java中,我有一个字符串:
In Java, I have a String:
Jamaica
我想删除字符串的第一个字符,然后返回 amaica
I would like to remove the first character of the string and then return amaica
我该怎么做?
推荐答案
使用 substring()
函数,参数为 1
,以获取从位置1(在第一个字符之后)到字符串末尾的子字符串(保留第二个参数默认为字符串的全长。)
Use the substring()
function with an argument of 1
to get the substring from position 1 (after the first character) to the end of the string (leaving the second argument out defaults to the full length of the string).
"Jamaica".substring(1);
这篇关于Java - 删除字符串的第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文