每日一“结”(5)
一.字符串 -String
1.字符串的连接,用“+”连接
2,互殴字符串的信息,s.length()获取字符串的长度,s.indexof(String str)从前往后查找字符串str第一次出现的位置,s.lastindexof(String str)从后往前查找字符str第一次出现的位置。
public class STring{
public static void main(String[]args){
String s="helloworld";
System.out.println(s.index("o"));
System.out.println(s.lastindex("o"));
}
}
执行后结果为:4
3
阅读更多声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇: 每日一“结”(3)
- 下一篇:没有了