org.eclipse.net4j.util

## Class StringUtil

- java.lang.Object
- - org.eclipse.net4j.util.StringUtil

-     public final class StringUtil
      extends java.lang.Object

  Various static helper methods for dealing with strings.
  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `EMPTY`
    `static java.lang.String` | `NL`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `cap(java.lang.String str)`
    `static java.lang.String` | `capAll(java.lang.String str)`
    `static int` | `compare(java.lang.String s1, java.lang.String s2)`
    `static java.lang.String` | `create(char c, int length)`
    `static boolean` | `equalsUpperOrLowerCase(java.lang.String s, java.lang.String upperOrLowerCase)`
    `static java.lang.String` | `formatException(java.lang.Throwable t)`
    `static boolean` | `glob(java.lang.String pattern, java.lang.String string)` Matches a string against a pattern.
    `static boolean` | `glob(java.lang.String pattern, java.lang.String string, java.lang.String[] subStrings)` Matches a string against a pattern and fills an array with the sub-matches.
    `static boolean` | `isEmpty(java.lang.String str)`
    `static int` | `occurrences(java.lang.String str, char c)`
    `static int` | `occurrences(java.lang.String str, java.lang.String c)`
    `static java.lang.String` | `replace(java.lang.String text, java.lang.String[] find, java.lang.String[] replace)`
    `static java.lang.String` | `safe(java.lang.String str)`
    `static java.lang.String` | `safe(java.lang.String str, java.lang.String def)`
    `static java.util.List<java.lang.String>` | `split(java.lang.String text, java.lang.String separators, java.lang.String brackets)`
    `static java.lang.String` | `translate(java.lang.String str, java.lang.String from, java.lang.String to)`
    `static java.lang.String` | `uncap(java.lang.String str)`
    `static java.lang.String` | `uncapAll(java.lang.String str)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY

          public static final java.lang.String EMPTY

      See Also:
        Constant Field Values

    - #### NL

          public static final java.lang.String NL

  - ### Method Detail

    - #### create

          public static java.lang.String create(char c,
                                                int length)

      Since:
        3.4

    - #### formatException

          public static java.lang.String formatException(java.lang.Throwable t)

      Since:
        2.0

    - #### replace

          public static java.lang.String replace(java.lang.String text,
                                                 java.lang.String[] find,
                                                 java.lang.String[] replace)

    - #### split

          public static java.util.List<java.lang.String> split(java.lang.String text,
                                                               java.lang.String separators,
                                                               java.lang.String brackets)

      Since:
        3.4

    - #### safe

          public static java.lang.String safe(java.lang.String str)

    - #### safe

          public static java.lang.String safe(java.lang.String str,
                                              java.lang.String def)

      Since:
        3.4

    - #### compare

          public static int compare(java.lang.String s1,
                                    java.lang.String s2)

    - #### equalsUpperOrLowerCase

          public static boolean equalsUpperOrLowerCase(java.lang.String s,
                                                       java.lang.String upperOrLowerCase)

      Since:
        3.1

    - #### capAll

          public static java.lang.String capAll(java.lang.String str)

      Since:
        2.0

    - #### cap

          public static java.lang.String cap(java.lang.String str)

    - #### uncapAll

          public static java.lang.String uncapAll(java.lang.String str)

      Since:
        2.0

    - #### uncap

          public static java.lang.String uncap(java.lang.String str)

    - #### occurrences

          public static int occurrences(java.lang.String str,
                                        char c)

    - #### occurrences

          public static int occurrences(java.lang.String str,
                                        java.lang.String c)

    - #### translate

          public static java.lang.String translate(java.lang.String str,
                                                   java.lang.String from,
                                                   java.lang.String to)

      Since:
        3.8

    - #### isEmpty

          public static boolean isEmpty(java.lang.String str)

    - #### glob

          public static boolean glob(java.lang.String pattern,
                                     java.lang.String string)

      Matches a string against a pattern.

      Pattern description:

      - `*` matches 0 or more characters
      - `?` matches a single character
      - `[...]` matches a set and/or range of characters
      - `\` escapes the following character
      Since:
        2.0

    - #### glob

          public static boolean glob(java.lang.String pattern,
                                     java.lang.String string,
                                     java.lang.String[] subStrings)

      Matches a string against a pattern and fills an array with the sub-matches.

      Pattern description:

      - `*` matches 0 or more characters
      - `?` matches a single character
      - `[...]` matches a set and/or range of characters
      - `\` escapes the following character
      Since:
        2.0

Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html