package com.heima.gaoshuai;
public class Test {
public static void main(String[] args) {
containsStrNum("hanbasdnbafllgnbahjnbakqqqqlnbaxi","nba");
}
/**
*
* 比如说“hanbasdnbafllgnbahjnbakqqqqlnbaxi”中有几个nba?
*/
public static void containsStrNum(String srcStr,String containsStr){
String[] spilted = srcStr.split(containsStr);
System.out.println("字符串“"+srcStr+"”中有"+(spilted.length-1)+"几个"+containsStr+"");
}
public class Test {
public static void main(String[] args) {
containsStrNum("hanbasdnbafllgnbahjnbakqqqqlnbaxi","nba");
}
/**
*
* 比如说“hanbasdnbafllgnbahjnbakqqqqlnbaxi”中有几个nba?
*/
public static void containsStrNum(String srcStr,String containsStr){
String[] spilted = srcStr.split(containsStr);
System.out.println("字符串“"+srcStr+"”中有"+(spilted.length-1)+"几个"+containsStr+"");
}