Java Code Examples for jodd.util.StringUtil#replace()

The following examples show how to use jodd.util.StringUtil#replace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EArea.java    From DAFramework with MIT License 5 votes vote down vote up
public List<Long> getPids() {
	if (!StringUtil.equals(parentIds, ",0,")) {
		pids = new ArrayList<>();
		parentIds = StringUtil.replace(parentIds, ",0,", "");
		String[] pidsStr = StringUtil.split(parentIds, ",");
		for (String pidStr : pidsStr) {
			if (StringUtil.isNotBlank(pidStr) && !StringUtil.equals(pidStr, "0")) {
				pids.add(Long.parseLong(pidStr));
			}
		}
		return pids;
	}
	return new ArrayList<>();
}
 
Example 2
Source File: EMenu.java    From DAFramework with MIT License 5 votes vote down vote up
public List<Long> getPids() {
	if (!StringUtil.equals(parentIds, ",0,")) {
		pids = new ArrayList<>();
		parentIds = StringUtil.replace(parentIds, ",0,", "");
		String[] pidsStr = StringUtil.split(parentIds, ",");
		for (String pidStr : pidsStr) {
			if (StringUtil.isNotBlank(pidStr) && !StringUtil.equals(pidStr, "0")) {
				pids.add(Long.parseLong(pidStr));
			}
		}
		return pids;
	}
	return new ArrayList<>();
}
 
Example 3
Source File: TextUtils.java    From DAFramework with MIT License 5 votes vote down vote up
public static boolean match(String text, String regex) {
	regex = StringUtil.replace(regex, "\\", "\\\\");
	regex = StringUtil.replace(regex, ".", "\\.");
	regex = StringUtil.replace(regex, "[", "\\[");
	regex = StringUtil.replace(regex, "]", "\\]");
	regex = StringUtil.replace(regex, "(", "\\(");
	regex = StringUtil.replace(regex, ")", "\\)");

	regex = StringUtil.replace(regex, "?", ".+");
	regex = StringUtil.replace(regex, "*", ".*");
	return text.matches(regex);
}
 
Example 4
Source File: SysToolkit.java    From DAFramework with MIT License 5 votes vote down vote up
public

	static String polishFilePath(String path) {
		String path2 = StringUtil.replace(path, "\\", File.separator);
		path2 = StringUtil.replace(path2, "/", File.separator);
		return path2;
	}
 
Example 5
Source File: StrMap.java    From DAFramework with MIT License 5 votes vote down vote up
public String eval(String text) {
	String out = text;
	for (String key : keySet()) {
		out = StringUtil.replace(out, "${" + key + "}", get(key));
	}
	return out;
}
 
Example 6
Source File: WCfg.java    From wES with MIT License 5 votes vote down vote up
public static String getPath(final String key, final String... profiles) {
	String path = getValue(key, profiles);
	path = path.trim();
	path = StringUtil.replace(path, "\\", File.separator);
	path = StringUtil.replace(path, "//", File.separator);
	if (!path.endsWith(File.separator)) {
		path += File.separator;
	}
	return getCfg().getValue(key, profiles);
}
 
Example 7
Source File: TextUtils.java    From wES with MIT License 5 votes vote down vote up
public static boolean match(String text, String regex) {
	regex = StringUtil.replace(regex, "\\", "\\\\");
	regex = StringUtil.replace(regex, ".", "\\.");
	regex = StringUtil.replace(regex, "[", "\\[");
	regex = StringUtil.replace(regex, "]", "\\]");
	regex = StringUtil.replace(regex, "(", "\\(");
	regex = StringUtil.replace(regex, ")", "\\)");

	regex = StringUtil.replace(regex, "?", ".+");
	regex = StringUtil.replace(regex, "*", ".*");
	return text.matches(regex);
}
 
Example 8
Source File: SysToolkit.java    From wES with MIT License 5 votes vote down vote up
public

	static String polishFilePath(String path) {
		String path2 = StringUtil.replace(path, "\\", File.separator);
		path2 = StringUtil.replace(path2, "/", File.separator);
		return path2;
	}
 
Example 9
Source File: StrMap.java    From wES with MIT License 5 votes vote down vote up
public String eval(String text) {
	String out = text;
	for (String key : keySet()) {
		out = StringUtil.replace(out, "${" + key + "}", get(key));
	}
	return out;
}