2012-05-05 83 views
-4
String ORIGINAL = "This is my demo string"; 
String search = "demo"; 

我想要得到的结果为真或假,如果“演示”是退出原始则结果为true,否则返回false如何搜索子字符串从原来的字符串

+11

使用'contains' ? 'indexOf'?你甚至看过字符串API吗? –

回答

1
if(ORIGINAL.contains(search)) 
    //found 
else 
    //not found