JAVA字符串截取与求模

public class splitdemo {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "abc,12,3yy98,0";
String [] strs = str.split(",");
for(int i =0,len=strs.length;i<len;i++){
System.out.println(strs[i].toString());

}

String sb = "S201899999999995500";//20位
String sp;
int sp1;

System.out.println(sb.substring(15));
sp = sb.substring(15, 19);
sp1 = Integer.parseInt(sp);
System.out.println("sp1"+"="+sp1);
if (sp1%32 > 17){
System.out.println("调度2库");
}else{
System.out.println("调度1库");
}


String sb1 = "bbbdsajjds";
System.out.println(sb1.substring(2,4));

String sb3 = "S201899999999995500";//20位
System.out.println(sb3.substring(15,19));//从15位截取到19,索引

int x = 5;
int y = 3;
int z;
System.out.println(x%y);
System.out.println(y%x);
System.out.println(5500%32);
System.out.println(32%5500);


int num1 = 19;
double num2 = 6.7;
double result;
result = num1 % num2;
System.out.println(result);

 

}

}

posted on 2018-04-14 20:51  sunny_2016  阅读(481)  评论(0编辑  收藏  举报

导航