Removes empty space from the end of a string

@param value -
to be trimmed
@return String
964186
public static String rTrim(final String value) {
        if (value == null) {
            return null;
        }

        String trimmed = value;
        int offset = value.length() - 1;
        while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) {
            offset--;
        }

        if (offset < value.length() - 1) {
            trimmed = value.substring(0, offset + 1);
        }

        return trimmed;
    }
170055
function trimUrlValue(value) {
    var beginSlice, endSlice;
    value = value.trim();
    beginSlice = value.charAt(0) === '\'' || value.charAt(0) === '"' ? 1 : 0;
    endSlice = value.charAt(value.length - 1) === '\'' ||
        value.charAt(value.length - 1) === '"' ?
        -1 : undefined;
    return value.slice(beginSlice, endSlice).trim();
}
730533
private String trimValueIfExceedsMaxLength(String entry, String value) {
        if (value == null) {
            return null;
        }

        String result = value;
        Integer maximumSize = ENTRY_TO_MAX_SIZE.get(entry);
        if (maximumSize != null && value.length() > maximumSize) {
            result = value.substring(0, maximumSize);
        }
        return result;
    }
1090012
public static String stripDelimiters(final String value) {
        if (value != null && value.length() > 1) {
            if (value.charAt(0) == value.charAt(value.length() - 1)
                    && (value.charAt(0) == '\'')) {
                return value.substring(1, value.length() - 1);
            }
            if (value.charAt(0) == value.charAt(value.length() - 1)
                    && (value.charAt(0) == '\"')) {
                return value.substring(1, value.length() - 1);
            }
        }
        return value;
    }
801198
public static String trim(final String value, final boolean trimmed) {
        if(!trimmed || value == null) {
            return value;
        }

        return value.trim();

    }
1111865
public static String nullIfEmpty(String value) {
		return value==null || value.isEmpty() ? null : value;
	}
245013
public static String trimAllWhitespace(final String str) {
    if (!StringUtils.hasLength(str)) {
      return str;
    }

    final int len = str.length();
    final StringBuilder sb = new StringBuilder(str.length());
    for (int i = 0; i < len; i++) {
      final char c = str.charAt(i);
      if (!Character.isWhitespace(c)) {
        sb.append(c);
      }
    }
    return sb.toString();
  }
1072529
protected function _cleanValue($value, $trim = false)
    {
        $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        return ($trim) ? trim($value) : $value;
    }
407307
public function filter($value)
    {
        $chars = ' ';
        if ($this->getExtras()) {
            $chars .= $this->getExtras();
        }
        return trim($value, $chars);
    }
1347151
public static String trim(String string)
  {
    if(string == null) {
      return null;
    }
    int length = string.length();
    int beginIndex = 0;
    for(; beginIndex < length; ++beginIndex) {
      if(!Character.isWhitespace(string.charAt(beginIndex))) break;
    }
    int endIndex = length - 1;
    for(; endIndex >= 0; --endIndex) {
      if(!Character.isWhitespace(string.charAt(endIndex))) break;
    }
    return string.substring(beginIndex, endIndex + 1);
  }
278596
public String clean(String value) {
    String orig = value;
    
    // check if there's a + before the first digit
    boolean initialplus = findPlus(value);
    
    // remove everything but digits
    value = sub.clean(value);
    if (value == null)
      return null;

    // check for initial '00'
    boolean zerozero = !initialplus && value.startsWith("00");
    if (zerozero)
      value = value.substring(2); // strip off the zeros

    // look for country code
    CountryCode ccode = findCountryCode(value);
    if (ccode == null) {
      // no country code, let's do what little we can
      if (initialplus || zerozero)
        return orig; // this number is messed up. dare not touch
      return value;

    } else {
      value = value.substring(ccode.getPrefix().length()); // strip off ccode
      if (ccode.getStripZero() && value.startsWith("0"))
        value = value.substring(1); // strip the zero

      if (ccode.isRightFormat(value))
        return "+" + ccode.getPrefix() + " " + value;
      else
        return orig; // don't dare touch this
    }
  }
825002
private static String formatValue(String value)
	{
		if(value == null)
			return "";
		
		value = value.trim();
		
		if(value.startsWith("\"")|| value.startsWith("'"))
			value = value.substring(1);
		
		if(value.endsWith("\"")|| value.endsWith("'"))
			value = value.substring(0, value.length() -1);
		
		return value;
	}
1334540
public static String[] split(String value) {
        if (value == null || "".equals(value)) {
            return EMPTY_STRING_ARRAY;
        }
        int len = value.length();
        List<String> list = new LinkedList<>();
        boolean collectingSpace = true;
        int start = 0;
        for (int i = 0; i < len; i++) {
            char c = value.charAt(i);
            if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
                if (!collectingSpace) {
                    list.add(value.substring(start, i));
                    collectingSpace = true;
                }
            } else {
                if (collectingSpace) {
                    start = i;
                    collectingSpace = false;
                }
            }
        }
        if (start < len) {
            int end = len;
            for (int i = 1; len > i; i++) {
                char c = value.charAt(len - i);
                if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
                    end--;
                    continue;
                }
                break;
            }
            list.add(value.substring(start, end));
        }
        return list.toArray(EMPTY_STRING_ARRAY);
    }
1031621
@Override
    public String stripQuotes(String value) {
        if (null == value) {
            return null;
        }
        String modvalue = value.trim();
        if (0 == modvalue.length()) {
            return modvalue;
        }
        boolean needTrimming = false;
        int start = 0;
        if ('"' == modvalue.charAt(0) || '\'' == modvalue.charAt(0)) {
            start = 1;
            needTrimming = true;
        }
        int end = modvalue.length() - 1;
        if ('"' == modvalue.charAt(end) || '\'' == modvalue.charAt(end)) {
            needTrimming = true;
        } else {
            end++;
        }
        if (needTrimming) {
            return modvalue.substring(start, end);
        }
        return modvalue;
    }
168399
private static String trimAtNull(final String s)
	{
		final int end = s.indexOf((char) 0);
		return end > -1 ? s.substring(0, end) : s;
	}
1237538
public static String normalizeHtmlNospace(SoyValue value) {
    value = normalizeNull(value);
    return normalizeHtmlNospace(value.coerceToString());
  }
1170506
public static String trim(String buffer) {
        // remove spaces in front
        int count = 0;
        for (int i = 0; i < buffer.length(); i++) {
            if (buffer.charAt(i) == SPACE_CHAR)
                count++;
            else
                break;
        }
        if (count > 0)
            buffer = buffer.substring(count);

        // remove spaces in the end
        count = buffer.length();
        for (int i = buffer.length() - 1; i > 0; i--) {
            if (buffer.charAt(i) == SPACE_CHAR && buffer.charAt(i - 1) != BACK_SLASH)
                count--;
            else
                break;
        }
        if (count != buffer.length())
            buffer = buffer.substring(0, count);

        return buffer;
    }