java String类

字符串属于对象
创建方法有多种:

String greeting = "菜鸟教程";
char[] helloArray = { 'r', 'u', 'n', 'o', 'o', 'b'};
String helloString = new String(helloArray);  
方法描述
char charAt(int index)指定索引处char的值
int compareTo(Object o)字符串和另一个对象比较
int compareTo(String anotherString)按字典顺序比较两个字符串
int compareToIgnoreCase(String str)按字典顺序比较两个字符串,不考虑大小写
String concat(String str)将指定字符串连接到此字符串的结尾,可以用+号实现
boolean contentEquals(StringBuffer sb)当且仅当字符串与指定的StringBuffer有相同顺序的字符时候返回真
static String copyValueOf(char[] data)返回指定数组中表示该字符序列的 String
static String copyValueOf(char[] data, int offset, int count)返回指定数组中表示该字符序列的 String
boolean endsWith(String suffix)是否以指定的后缀结束
boolean equals(Object anObject)将此字符串与指定的对象比较
boolean equalsIgnoreCase(String anotherString)将此 String 与另一个 String 比较,不考虑大小写

StringBufferStringBuilder

参考文献:
http://www.runoob.com/java/java-string.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值