码迷,mamicode.com
首页 > 其他好文 > 详细

String的indexof的使用

时间:2016-10-14 20:12:10      阅读:144      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!