Example
Return the first character (0) of a string:
返回字符串的第一个字符(0):
String myStr = "Hello";
char result = myStr.charAt(0);
System.out.println(result); // H
原创2022年11月13日...大约 2 分钟
Return the first character (0) of a string:
返回字符串的第一个字符(0):
String myStr = "Hello";
char result = myStr.charAt(0);
System.out.println(result); // H
Find out if a string contains a sequence of characters:
找出一个字符串是否包含一个字符序列:
String myStr = "Hello";
System.out.println(myStr.contains("Hel")); // true
System.out.println(myStr.contains("e")); // true
System.out.println(myStr.contains("Hi")); // false