- public class StringFind {
- public static void main(String[] args) {
- final String NBA = "nba";
- final String s = "nbaasdnbaqwenbanbauionba";
- // final String s = "nbanbanbanba";
- // final String s = "nba";
- // split(String regex, int limit) 能解决出现在任何位置
- System.out.println(s.split(NBA, -1).length - 1);
- }
- }
复制代码 |
|