Trims value and replaces all (sequences of) whitespace to a single space.
@param value value to clean up.
@return trimmed value with all whitespace converted to single space.
556189
public String normalizeWhitespace(String value) {
        String result = null;
        if (value != null) {
            value = value.trim();
            result = replaceAllInWith("\\s+", value, " ");
        }
        return result;
    }
462982
public static String trimWhitespace(String str) {
        if (!hasLength(str)) {
            return str;
        }
        StringBuilder buf = new StringBuilder(str);
        while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
            buf.deleteCharAt(0);
        }
        while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
            buf.deleteCharAt(buf.length() - 1);
        }
        return buf.toString();
    }
1278426
public static Slice trim(Slice utf8, int[] whiteSpaceCodePoints)
    {
        int start = firstNonMatchPosition(utf8, whiteSpaceCodePoints);
        int end = lastNonMatchPosition(utf8, start, whiteSpaceCodePoints);
        return utf8.slice(start, end - start);
    }
1108760
public static String replaceSupplementary(final String value)
    {
        return InterpolationHelper.replaceSupplementary(value, new Replacer()
        {
            public String replace(String in)
            {
                return Strings.nullToEmpty(UCharacter.getName(in, ", "));
            }
        });
    }
402897
function _trim($value)
    {
        for ($i = count($value) - 1; $i >= 0; --$i) {
            if ($value[$i]) {
                break;
            }
            unset($value[$i]);
        }

        return $value;
    }
791500
public synchronized long addValue(String value) {
		sequences.add(++lastSequence);
		values.add(value);
		return lastSequence;
	}
716256
public static String trimWhitespace(final String str) {
    if (!StringUtils.hasLength(str)) {
      return str;
    }

    int beginIndex = 0;
    int endIndex = str.length() - 1;

    while (beginIndex <= endIndex && Character.isWhitespace(str.charAt(beginIndex))) {
      beginIndex++;
    }

    while (endIndex > beginIndex && Character.isWhitespace(str.charAt(endIndex))) {
      endIndex--;
    }

    return str.substring(beginIndex, endIndex + 1);
  }
282121
public String removeWhitespace(String value) {
        String result = null;
        if (value != null) {
            result = replaceAllInWith("\\s+", value, "");
        }
        return result;
    }
614830
final String removeUnit(String value)
	{
		final int i;
		if (dpt.getUnit().length() > 0 && (i = value.lastIndexOf(dpt.getUnit())) > -1)
			return value.substring(0, i).trim();
		// java number parsing routines are really picky, remove WS
		return value.trim();
	}
123477
public <T> T cleanupValue(T rawValue) {
        T cleanValue;
        if (rawValue instanceof String) {
            cleanValue = (T) cleanupValue((String) rawValue);
        } else {
            cleanValue = rawValue;
        }
        return cleanValue;
    }
77528
private static String trimLeadingWhitespace(String string) {
        if (string.isEmpty()) {
            return string;
        }

        int start = 0;
        char c;

        for (int i = 0; i < string.length(); i++) {
            c = string.charAt(i);
            if (!Character.isWhitespace(c)) {
                start = i;
                break;
            }
        }

        if (start == 0) {
            return string;
        }

        return string.substring(start);
    }
1037744
public T put(final T value) {
		expungeStaleEntries();
		//
		final int hash = value.hashCode();
		int index = (hash & 0x7FFFFFFF) % elementData.length;
		Entry<T> entry = elementData[index];
		while (entry != null && !eq(value, entry.get())) {
			entry = entry.nextInSlot;
		}

		if (entry == null) {
			if (++elementCount > threshold) {
				expandElementArray(elementData.length);
				index = (hash & 0x7FFFFFFF) % elementData.length;
			}
			entry = createHashedEntry(value, index);
			return null;
		}

		final T result = entry.get();
		return result;
	}
1237538
public static String normalizeHtmlNospace(SoyValue value) {
    value = normalizeNull(value);
    return normalizeHtmlNospace(value.coerceToString());
  }
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;
    }
197792
public static String fixValue(String value) {
		if (value != null && !value.equals("")) {
			final String[] words = value.toLowerCase().split("_");
			value = "";
			for (final String word : words) {
				if (word.length() > 1) {
					value += word.substring(0, 1).toUpperCase() + word.substring(1) + " ";
				} else {
					value = word;
				}
			}
		}
		if (value.contains("\\n")) {
			value = value.replace("\\n", System.getProperty("line.separator"));
		}
		return value;
	}
913125
public function clean($value)
  {
    // First prune whitespace.
    $cleaner = PruneWhitespaceCleaner::get();
    $value   = $cleaner->clean($value);

    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    $tidyConfig = ['clean'          => false,
                   'output-xhtml'   => true,
                   'show-body-only' => true,
                   'wrap'           => 100];

    $tidy = new \tidy;

    $tidy->parseString($value, $tidyConfig, self::getTidyEncoding());
    $tidy->cleanRepair();
    $value = trim(tidy_get_output($tidy));

    // In some cases Tidy returns an empty paragraph only.
    if (preg_match('/^(([\ \r\n\t])|(<p>)|(<\/p>)|(&nbsp;))*$/', $value)==1)
    {
      $value = null;
    }

    return $value;
  }
49603
public boolean removeValue(Object value) {
		try {
			boolean result = false;
			if (isCluster(groupName)) {
				result = getBinaryJedisClusterCommands(groupName).lrem(keyBytes, 0, valueSerialize(value)) >= 1;
			} else {
				result = getBinaryJedisCommands(groupName).lrem(keyBytes, 0, valueSerialize(value)) >= 1;
			}
			return result;
		} finally {
			getJedisProvider(groupName).release();
		}
	}