字符串替换

@param str
String
@param strReplace
String
@param strWith
@return String
490187
static public String replaceString(String str, String strReplace,
			String strWith) {
		StringBuffer sb = new StringBuffer();
		int iCurrent = 0;
		int iFound;
		int iReplaceLen = strReplace.length();

		if (str == null || strReplace == null || strWith == null)
			return str;
		if (str.equals("") || strReplace.equals(""))
			return str;

		while (true) {
			iFound = str.indexOf(strReplace, iCurrent);
			if (iFound == -1) {
				sb.append(str.substring(iCurrent));
				break;
			}

			if (iFound != iCurrent)
				sb.append(str.substring(iCurrent, iFound));
			sb.append(strWith);
			iCurrent = iFound + iReplaceLen;
		}

		return sb.toString();
	}
925450
function strEndWith(str,substr){
    return str.lastIndexOf(substr) + substr.length === str.length;
}
993234
public int lookupIndex(String str, int indent) {
		if (indent < 1)
			throw new IllegalArgumentException(
					"Invalid Argument in FeatureAlphabet: " + indent);

		int ret = data.get(str);

		if (ret==-1 && !frozen) {//字典中没有，并且允许插入
			synchronized (this) {
				data.put(str, last);
				ret = last;
				last += indent;
			}
		}
//		if(ret==0)
//			System.out.println(str);
		return ret;
	}
1046411
public StringGrabber insertIntoHead(String str) {

		if (str != null) {
			try {
				sb.insert(0, str);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		return StringGrabber.this;
	}
1351378
public static String ltrim(String str, String defaultValue) {
	if (str == null) return defaultValue;
	int len = str.length();
	int st = 0;

	while ((st < len) && (str.charAt(st) <= ' ')) {
	    st++;
	}
	return ((st > 0)) ? str.substring(st) : str;
    }
1235247
function stringDivider(str, width, spaceReplacer) {
  if (str.length > width) {
    let p = width;
    while (p > 0 && (str[p] != ' ' && str[p] != '-')) {
      p--;
    }
    if (p > 0) {
      let left;
      if (str.substring(p, p + 1) == '-') {
        left = str.substring(0, p + 1);
      } else {
        left = str.substring(0, p);
      }
      const right = str.substring(p + 1);
      return left + spaceReplacer + stringDivider(right, width, spaceReplacer);
    }
  }
  return str;
}
917725
public String noSpaces(String str, String replaceWith) {
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		params.putSingle("string", str);
		params.putSingle("replacement", replaceWith);
		return getEntity(invokeGet("utils/nospaces", params), String.class);
	}
208897
private static String decode(final String str) {
        if (str == null) {
            return null;
        }

        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == '%') {
                return decode(str, i);
            }
        }

        return str;
    }
1051026
public static String repeatString(String str, int count) {
	if (count <= 0) return "";
	char[] chars = str.toCharArray();
	char[] rtn = new char[chars.length * count];
	int pos = 0;
	for (int i = 0; i < count; i++) {
	    for (int y = 0; y < chars.length; y++)
		rtn[pos++] = chars[y];
	    // rtn.append(str);
	}
	return new String(rtn);
    }
1279882
public static final String join(CharSequence delimiter, CharSequence... strs)
	{
		return StringUtils.join(strs, delimiter.toString());
	}
1061144
function strRepeat(str, n, sep) {
  if(!n) {
    return str;
  }
  return str + sep + strRepeat(str, --n, sep);
}
340327
public static String noSpaces(String str, String replaceWith) {
		return StringUtils.isBlank(str) ? "" : str.trim().replaceAll("[\\p{C}\\p{Z}]+",
				StringUtils.trimToEmpty(replaceWith)).toLowerCase();
	}
241964
function stringRepeat (str, count) {
  var rest = '' + str
  if (str.repeat) {
    return str.repeat(count)
  }
  var list = isNaN(count) ? [] : new Array(parseInt(count))
  return list.join(rest) + (list.length > 0 ? rest : '')
}
662900
public static String add( String str, String str2 ) {
        return FastStringUtils.noCopyStringFromChars(
                Chr.add(
                 FastStringUtils.toCharArray(str),
                 FastStringUtils.toCharArray(str2) )
        );
    }
922725
public String find(String str, String regex) {
		if (str == null || regex == null)
			return "";
		Matcher m = Pattern.compile(regex).matcher(str);
		if (m.find()) {
			return m.group();
		} else
			return "";
	}
1258405
public void addString(String str) {
        if (mSize == mStrings.length) {
            String[] old = mStrings;
            int oldSize = old.length;
            mStrings = new String[oldSize + (oldSize << 1)];
            System.arraycopy(old, 0, mStrings, 0, oldSize);
        }
        mStrings[mSize++] = str;
    }
648338
public static String replace(String str, int start, int end, String rp) {
        if (str == null || start < 0 || start > end || end >= str.length()) {
            throw new IllegalArgumentException("参数非法");
        }

        return str.substring(0, start) + rp + str.substring(end + 1);
    }