Class Strings

java.lang.Object
org.eclipse.emf.compare.provider.spec.Strings

public final class Strings
extends java.lang.Object
Utility class for Strings objects.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String elide​(java.lang.String original, int max, java.lang.String suffix)
    Shorten the given original string and append the given suffix if it is longest than the defined max length minus the length of the suffix.
    static java.lang.String removeLineBreaks​(java.lang.String original)
    Removes line-breaks (\r\n or \r or \n) from the given original and replaces it with blanks.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • elide

      public static java.lang.String elide​(java.lang.String original, int max, java.lang.String suffix)
      Shorten the given original string and append the given suffix if it is longest than the defined max length minus the length of the suffix.

      The returned String length will always be in Math.min(original.length, max).

      Parameters:
      original - the original string to elide if necessary.
      max - the maximum length of the returned string.
      suffix - the suffix to append in case the original String is too long.
      Returns:
      the elided string or the original string.
    • removeLineBreaks

      public static java.lang.String removeLineBreaks​(java.lang.String original)
      Removes line-breaks (\r\n or \r or \n) from the given original and replaces it with blanks.
      Parameters:
      original - the original string to remove line breaks from.
      Returns:
      the string without line breaks but blanks instead.
      Since:
      4.1