Share code snippets.

RemoveCharsBetweenChars

Created 6 years ago by anonymous
Remove string between two chars like removeBetween(string, "<", ">"); without using regular expression
private static String removeBetween(String string, String startChars, String endChars) {
		if(string.contains(startChars)&& string.contains(endChars)) {
			String substringAfter = StringUtils.substringAfterLast(string, startChars);
			String substringBefore = StringUtils.substringBefore(substringAfter, endChars);
			String finalStr = StringUtils.remove(string ,startChars + substringBefore+ endChars);
			string =removeBetween(finalStr, startChars, endChars);
		}
		return string;
	}