Java Code Examples for org.apache.commons.lang.StringUtils.replaceChars()

The following are Jave code examples for showing how to use replaceChars() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: EscapeLag   File: AzureAPI.java   Source Code and License Vote up 6 votes
@SuppressWarnings("all")
public static Object colorzine(Object o) {
    if (o instanceof String) {
        return StringUtils.replaceChars((String) o, '&', '§');
    }
    if (o instanceof List) {
        List list = (List) o;
        for (Object obj : list) {
            if (obj instanceof String) {
                list.set(list.indexOf(obj), StringUtils.replaceChars((String) obj, '&', '§'));
            }
        }
        return list;
    }
    return o;
}
 
Example 2
Project: Hydrograph   File: OperatorToolCombo.java   Source Code and License Vote up 6 votes
private void loadDropDownItems() {
	Properties properties=new Properties();
	InputStream inStream;
	try {
		inStream = ExpressionEditorUtil.INSTANCE.getPropertyFilePath(PathConstant.OPERATOR_CONFIG_FILE);
		properties.load(inStream);
		for(Object key:properties.keySet()){
			if(key!=null && properties.get(key)!=null){
				String operatorName=StringUtils.replaceChars((String) key, '_', SWT.SPACE);
			this.add(operatorName);
			this.setData(operatorName, (String)properties.get(key));
			}
		}
	} catch (IOException | RuntimeException exception ) {
		LOGGER.error("Exception occurred while loading property file.",exception);
		StringBuffer buffer=new StringBuffer();
		buffer.append(Messages.OPERATOR_FILE_NOT_FOUND);
		new CustomMessageBox(SWT.ICON_WARNING,buffer.toString() , Messages.WARNING).open();
	}
}
 
Example 3
Project: Recreator   File: Configurable.java   Source Code and License Vote up 6 votes
@SuppressWarnings("all")
public static Object colorzine(Object o) {
    if (o instanceof String) {
        return StringUtils.replaceChars((String) o, '&', '§');
    }
    if (o instanceof List) {
        List list = (List) o;
        for (Object obj : list) {
            if (obj instanceof String) {
                list.set(list.indexOf(obj), StringUtils.replaceChars((String) obj, '&', '§'));
            }
        }
        return list;
    }
    return o;
}