字符串
作者:互联网
字符串长度判断
字符串.length
字符串判断是否相等
a.equal(b);
字符串遍历
String line=sc.nextline();
for(i=0;i<line.length();i++){
sout(line.chatAt(i));
}
字符串统计
String line=sc.nextline()
int big=0
int small=0
int num=0
for(i=0;i<line.length();i++){
char ch=line.charAt(i);
if(ch>='A'&&ch<='Z'){big=big+1}
else if(ch>='a'&&ch<='z'){...........}
elseif(ch>='0'&&ch<='9'){..........}
}
sout()
sout()
sout()
字符串拼接
(输出的是【1,2,3】)
int arr={1,2,3};
String s=arg(arr);
sout(s);
public static String arg(int [] arr){
String s="";
s+="[";
for(i=0;i<arr.length();i++){
if(i==arr.length()-1){
s+=arr[i]
}
else{
s+=arr[i];
s+=",";
}
}
return s;
}
标签:arr,ch,String,int,sout,字符串 来源: https://www.cnblogs.com/wang--/p/16028985.html