另請參閱:
How to see if a substring exists inside another string in Java 1.4
Searching for one string in another string
How to search a string in another string?如何在Java字符串中查找給定單詞的存在?
我有兩個字符串,像這樣:
String str1 = "He is doing very good";
String str2 = "doing";
我想知道如何找到字符串012在字符串「做」,即使str1
改變,像這樣:
str1 = "He isdoing very good";
提問之前檢查文檔。這是最基本的。 – keyser
查看文檔或Google ... https://www.google.com/search?q=how+to+find+string+in+another+string+in+java&oq=how+to+find+string+in +另一個+字符串+在+ java – Buggabill
甚至只是搜索以前的SO問題。我發現這一個:http://stackoverflow.com/questions/2940114/searching-for-one-string-in-another-string和更多。 –