首页 > 其他 > 详细

String的indexof的使用

时间:2016-10-14 20:09:20      阅读:159      评论:0      收藏:0      [点我收藏+]

public class Test8 {

public static int getNum() {
int num = 555667;
boolean b = true;
int temp = 1;
int he = 0;
while(b){
temp++;
he = num*temp;
String str = he+"";
//indexof 就是看str包含不包含这个数字 包含不等于-1
if(str.indexOf("1") != -1){
if(str.indexOf("2") != -1){
if(str.indexOf("3") != -1){
if(str.indexOf("4") != -1){
if(str.indexOf("5") != -1){
if(str.indexOf("6") != -1){
if(str.indexOf("7") != -1){
if(str.indexOf("8") != -1){
if(str.indexOf("9") != -1){
return he;
}
}
}
}
}
}
}
}
}
}
return 0;
}

public static void main(String[] args) {
System.out.println(Test8.getNum());
}
}

String的indexof的使用

原文:http://www.cnblogs.com/flord/p/5961589.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!