String
String
charAt
返回指定索引的字符:
1 | String a = new String("Hello world\n"); |
compareTo
与其他字符串比较
- 相同为0
- 用大比小:正
- 用小比大:负
1 | String a = new String("hello"); |
输出:
1 | 10 -10 0 |
compareTolgnoreCase
与其他字符串比较,忽略大小写
concat
返回字符串拼接值
1 | String a = new String ("hello "); |
length
返回字符串长度
1 | String a = new String ("hello world"); |
- Title: String
- Author: Nannan
- Created at : 2024-03-11 20:27:00
- Updated at : 2024-09-30 20:58:33
- Link: https://redefine.ohevan.com/2024/03/11/七、String/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments