//在字符串中查找子字符串的个数
private static int getSubStringNum(String parentString , String subString)
{
int num = 0;
if(parentString.indexOf(subString) != -1)
{
String[] str1 = parentString.split(subString);
num = str1.length-1;
}
return num;
}
//查找子字符串在父字符串中的位置,如643,369,95
private static String getSubStringIndexs(String parentString , String subString)
{
String result = "";
while(parentString.lastIndexOf(subString) != -1)
{
result = result + parentString.lastIndexOf(subString) + ",";
parentString = parentString.substring(0, parentString.lastIndexOf(subString));
}
if(null != result && !"".equals(result))
{
result = result.substring(0,result.length()-1);
}
return result;
}
//businessid:'190970'获取190970值
private static String getSubStringValue(String parentString, int beginIndex, String sub)
{
String result = "";
int endIndex = parentString.indexOf(sub, beginIndex);
result = parentString.substring(beginIndex, endIndex);
return result;
}
//在字符串指定位置插入字符串
private static String insertString(String parentString, int index, String str)
{
StringBuilder sb = new StringBuilder();
sb.append(parentString.substring(0, index));
sb.append(str);
sb.append(parentString.substring(index));
return sb.toString();
}