TextUtil.java 999 Bytes
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.aemfd.watchfolder.job;

public class TextUtil {
    public static boolean isEmpty(String aValue) {
        return aValue == null || aValue.trim().length() == 0;
    }

    public static String isNull(String aValue, String aReplacement) {
        if (aValue == null || aValue.trim().length() == 0) {
            return aReplacement;
        }
        return aValue;
    }

    public static String replace(String aOriginalText, String aText, String aReplacement) {
        StringBuffer _newText = new StringBuffer();
        int _startIndex = 0;
        int _endIndex = 0;
        while ((_endIndex = aOriginalText.indexOf(aText, _startIndex)) > -1) {
            _newText.append(aOriginalText.substring(_startIndex, _endIndex));
            _newText.append(aReplacement);
            _startIndex = _endIndex + aText.length();
        }
        _newText.append(aOriginalText.substring(_startIndex));
        return _newText.toString();
    }
}