-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStringTest.java
More file actions
38 lines (26 loc) · 877 Bytes
/
Copy pathStringTest.java
File metadata and controls
38 lines (26 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package java_base;
import java.util.Arrays;
public class StringTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s1 = "abc";
String s2 = "abc";
char[] ca = {'a', 'b', 'c'};
String s3 = new String(ca);
String s = "0123456789";
String s7 = "美国、中国、加拿大、英国、德国";
char[] cal = s7.toCharArray();
System.out.println("s.charAt(5) = " + s.charAt(5));
System.out.println("abcdefabcdaaa".indexOf('c'));
System.out.println("Let's make things better".replace('e', 'o'));
System.out.println("01234567890123456".matches("\\d{17}"));
System.out.println("012345ab123456".matches("\\d{17}"));
String[] sa = s7.split("[、| , |。]");
System.out.println(Arrays.toString(sa));
for(String str:sa)
{
System.out.println(str);
}
System.out.println("smiles".substring(1, 5));
}
}