Class MString


  • public class MString
    extends Object
    Author:
    hummel
    • Field Detail

      • CHARSET_CHARSET_UTF_8

        public static final Charset CHARSET_CHARSET_UTF_8
      • CHARSET_CHARSET_UTF_16

        public static final Charset CHARSET_CHARSET_UTF_16
      • CHARSET_CHARSET_ISO_8859_1

        public static final Charset CHARSET_CHARSET_ISO_8859_1
      • WHITESPACE

        public static final char[] WHITESPACE
      • CHARS_READABLE

        public static final char[] CHARS_READABLE
      • ASCII127_MAPPING

        public static final Map<String,​String> ASCII127_MAPPING
      • EMPTY_PAIR

        public static final String[] EMPTY_PAIR
        A pair (index 0 and 1) with empty strings
      • NULL_PAIR

        public static final String[] NULL_PAIR
        A pair (index 0 and 1) with null values
    • Constructor Detail

      • MString

        public MString()
    • Method Detail

      • isSetTrim

        public static boolean isSetTrim​(String _in)
        Return true if the the string is not empty also trimmed.
        Parameters:
        _in - The string to test
        Returns:
        true if the string is not null and not an empty string and not only contains whitespaces
      • isSet

        public static boolean isSet​(String _in)
        Return true if the the string is not empty.
        Parameters:
        _in - The string to test
        Returns:
        true if the string is not null and not an empty string
      • isEmpty

        public static boolean isEmpty​(String _in)
        Returns true if the string is null or an empty string.
        Parameters:
        _in -
        Returns:
        true if empty
      • split

        public static String[] split​(String _in,
                                     String _pattern)
        Split the string in parts. Separator is a pattern. In difference of the build in split it will not remove empty parts and the pattern is not a regex.
        Parameters:
        _in -
        _pattern -
        Returns:
        parts
      • splitIgnoreEmpty

        public static String[] splitIgnoreEmpty​(String _in,
                                                String _pattern)
        Split the string in parts. Separator is a pattern. In difference of the build in the pattern is not a regex.
        Parameters:
        _in -
        _pattern -
        Returns:
        parts
      • splitIgnoreEmpty

        public static String[] splitIgnoreEmpty​(String _in,
                                                String _pattern,
                                                boolean trim)
      • replaceAll

        public static String replaceAll​(String _src,
                                        String _pattern,
                                        String _replacement)
        Replace all pattern thru replacement strings. Pattern is not a regex.
        Parameters:
        _src -
        _pattern -
        _replacement -
        Returns:
        new string
      • replaceAll

        public static void replaceAll​(StringBuilder _src,
                                      String _pattern,
                                      String _replacement)
        Replace all pattern thru replacement strings. Pattern is not a regex.
        Parameters:
        _src -
        _pattern -
        _replacement -
      • isIndex

        public static boolean isIndex​(String _s,
                                      String _c)
        Return, if the char is located in the string (indexOf). If _s is null, return is false.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        true if index was found
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         String _c)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part before the index
      • afterIndex

        public static String afterIndex​(String _s,
                                        String _c)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part after the index
      • isIndex

        public static boolean isIndex​(String _s,
                                      char _c)
        Return, if the char is located in the string (indexOf). If _s is null, return is false.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        true if the index was found
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         char _c)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part before the index
      • afterIndex

        public static String afterIndex​(String _s,
                                        char _c)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part after the index
      • isIndex

        public static boolean isIndex​(String _s,
                                      char[] _c)
        Returns true if one of the chars is found in the string. If _s is null, return is false.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        true if one of the character was found
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         char[] _c)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part before the first found character
      • afterIndex

        public static String afterIndex​(String _s,
                                        char[] _c)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        part after the first found character
      • indexOf

        public static int indexOf​(String _s,
                                  char[] _c,
                                  int offset)
        Returns the position where the first of one of the chars is found in the string. If _s is null, return is -1.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        offset -
        Returns:
        position of the first found character
      • indexOf

        public static int indexOf​(String _s,
                                  char[] _c)
        Returns the position where the first of one of the chars is found in the string.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        Returns:
        position of the first found character
      • beforeLastIndex

        public static String beforeLastIndex​(String string,
                                             char c)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        Returns:
        string before the last found character
      • afterLastIndex

        public static String afterLastIndex​(String string,
                                            char c)
        Return the part after the last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        Returns:
        part after last found character
      • beforeLastIndex

        public static String beforeLastIndex​(String string,
                                             String c)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        Returns:
        part before last found character
      • afterLastIndex

        public static String afterLastIndex​(String string,
                                            String c)
        Return the part after the last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        Returns:
        part after last found character
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         String _c,
                                         String _def)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part before the index
      • afterIndex

        public static String afterIndex​(String _s,
                                        String _c,
                                        String _def)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part after the index
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         char _c,
                                         String _def)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part before the index
      • afterIndex

        public static String afterIndex​(String _s,
                                        char _c,
                                        String _def)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part after the index
      • beforeIndex

        public static String beforeIndex​(String _s,
                                         char[] _c,
                                         String _def)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part before the first found character
      • afterIndex

        public static String afterIndex​(String _s,
                                        char[] _c,
                                        String _def)
        Return the string after _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part after the first found character
      • beforeLastIndex

        public static String beforeLastIndex​(String string,
                                             char c,
                                             String def)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        string before the last found character
      • afterLastIndex

        public static String afterLastIndex​(String string,
                                            char c,
                                            String def)
        Return the part after the last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        part after last found character
      • beforeLastIndex

        public static String beforeLastIndex​(String string,
                                             String c,
                                             String def)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        part before last found character
      • afterLastIndex

        public static String afterLastIndex​(String string,
                                            String c,
                                            String def)
        Return the part after the last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        part after last found character
      • splitIndex

        public static String[] splitIndex​(String _s,
                                          String _c,
                                          String[] _def)
        Return the string before and after _c in _s. If _c is not found in _s, or _s is null then return is _def.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        0: part before the index, 1: part after the index
      • splitIndex

        public static String[] splitIndex​(String _s,
                                          char _c,
                                          String[] _def)
        Return the string before and after _c in _s. If _c is not found in _s, or _s is null then return is _def.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        0: part before the index, 1: part after the index
      • splitIndex

        public static String[] splitIndex​(String _s,
                                          char[] _c,
                                          String[] _def)
        Return the string before _c in _s. If _c is not found in _s, return is an empty string. If _s is null, return is null.
        Parameters:
        _s - The string to search in
        _c - The delimiter
        _def - Default value, if _s is null or _c not found
        Returns:
        part before the first found character
      • splitLastIndex

        public static String[] splitLastIndex​(String string,
                                              char c,
                                              String[] def)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        string before the last found character
      • splitLastIndex

        public static String[] splitLastIndex​(String string,
                                              String c,
                                              String[] def)
        Return part before last occurrence of the char. If the char is not found it will return the hole string.
        Parameters:
        string -
        c -
        def - Default value, if _s is null or _c not found
        Returns:
        part before last found character
      • encodeWebUnicode

        public static String encodeWebUnicode​(String _in)
        Encodes for the web. Same like MXml.encode
        Parameters:
        _in -
        Returns:
        encoded string
      • isUnicode

        public static boolean isUnicode​(String _in,
                                        char _joker,
                                        boolean encodeCr)
      • encodeUnicode

        public static String encodeUnicode​(String _in)
      • encodeUnicode

        public static String encodeUnicode​(String _in,
                                           boolean encodeCr)
      • encodeURIComponent

        public static String encodeURIComponent​(String _in)
      • decodeUnicode

        public static String decodeUnicode​(String _in)
      • decodeURIComponent

        public static String decodeURIComponent​(String _in)
      • encodeCSVLine

        public static String encodeCSVLine​(String[] _fields)
      • encodeCSV

        public static String encodeCSV​(String _field)
      • decodeCSV

        public static String decodeCSV​(String _field)
      • compareRegexPattern

        public static boolean compareRegexPattern​(String str,
                                                  String pattern)
      • compareSQLLikePattern

        public static boolean compareSQLLikePattern​(String str,
                                                    String pattern)
        Use % at the beginning and/or the end example: %aloa% or !%aloa%
        Parameters:
        str -
        pattern -
        Returns:
        true if match
      • compareFsLikePattern

        public static boolean compareFsLikePattern​(String str,
                                                   String pattern)
        Use * at the beginning or/and the end and a ! at the beginning for 'not'. e.g. *aloa* !*aloa*
        Parameters:
        str -
        pattern -
        Returns:
        true if match
      • join

        public static String join​(String[] src,
                                  char glue)
      • join

        public static String join​(long[] src,
                                  char glue)
      • canonical

        public static String canonical​(String s)
        Convert String to canonical standard form. null -> "". Trims lead trail blanks.
        Parameters:
        s - String to be converted.
        Returns:
        String in canonical form.
      • condense

        public static String condense​(String s)
        Collapse multiple spaces in string down to a single space. Remove lead and trailing spaces.
        Parameters:
        s - String to strip of blanks.
        Returns:
        String with all blanks, lead/trail/embedded removed.
      • countLeading

        public static int countLeading​(String text,
                                       char c)
        count of how many leading characters there are on a string matching a given character. It does not remove them.
        Parameters:
        text - text with possible leading characters, possibly empty, but not null.
        c - the leading character of interest, usually ' ' or '\n'
        Returns:
        count of leading matching characters, possibly 0.
      • countTrailing

        public static int countTrailing​(String text,
                                        char c)
        count of how many trailing characters there are on a string matching a given character. It does not remove them.
        Parameters:
        text - text with possible trailing characters, possibly empty, but not null.
        c - the trailing character of interest, usually ' ' or '\n'
        Returns:
        count of trailing matching characters, possibly 0.
      • isEmptyTrim

        public static boolean isEmptyTrim​(String s)
        Is this string empty?
        Parameters:
        s - String to be tested for emptiness.
        Returns:
        true if the string is null or equal to the "" null string. or just blanks
      • isLegal

        public static boolean isLegal​(String candidate,
                                      String legalChars)
        Ensure the string contains only legal characters
        Parameters:
        candidate - string to test.
        legalChars - characters than are legal for candidate.
        Returns:
        true if candidate is formed only of chars from the legal set.
      • isUnaccentedLowerCase

        public static boolean isUnaccentedLowerCase​(char c)
        Check if char is plain ASCII lower case.
        Parameters:
        c - char to check
        Returns:
        true if char is in range a..z
        See Also:
        Character.isLowerCase(char)
      • isUnaccentedUpperCase

        public static boolean isUnaccentedUpperCase​(char c)
        Check if char is plain ASCII upper case.
        Parameters:
        c - char to check.
        Returns:
        true if char is in range A..Z.
        See Also:
        Character.isUpperCase(char)
      • leftPad

        public static String leftPad​(String s,
                                     int newLen,
                                     boolean chop)
        Pads the string out to the given length by applying blanks on the left.
        Parameters:
        s - String to be padded/chopped.
        newLen - length of new String desired.
        chop - true if Strings longer than newLen should be truncated to newLen chars.
        Returns:
        String padded on left/chopped to the desired length.
      • parseDirtyLong

        public static long parseDirtyLong​(String numStr)
        convert a String to a long. The routine is very forgiving. It ignores invalid chars, lead trail, embedded spaces, decimal points etc. Dash is treated as a minus sign.
        Parameters:
        numStr - String to be parsed.
        Returns:
        long value of String with junk characters stripped.
        Throws:
        NumberFormatException - if the number is too big to fit in a long.
      • parseLongPennies

        public static long parseLongPennies​(String numStr)
        convert a String into long pennies. It ignores invalid chars, lead trail, embedded spaces. Dash is treated as a minus sign. 0 or 2 decimal places are permitted.
        Parameters:
        numStr - String to be parsed.
        Returns:
        long pennies.
        Throws:
        NumberFormatException - if the number is too big to fit in a long.
      • penniesToString

        public static String penniesToString​(long pennies)
        Print dollar currency, stored internally as scaled int. convert pennies to a string with a decorative decimal point.
        Parameters:
        pennies - long amount in pennies.
        Returns:
        amount with decorative decimal point, but no lead $.
      • rep

        public static String rep​(char c,
                                 int count)
        Produce a String of a given repeating character.
        Parameters:
        c - the character to repeat
        count - the number of times to repeat
        Returns:
        String, e.g. rep('*',4) returns "****"
      • rightPad

        public static String rightPad​(String s,
                                      int newLen,
                                      boolean chop)
        Pads the string out to the given length by applying blanks on the right.
        Parameters:
        s - String to be padded/chopped.
        newLen - length of new String desired.
        chop - true if Strings longer than newLen should be truncated to newLen chars.
        Returns:
        String padded on left/chopped to the desired length.
      • squish

        public static String squish​(String s)
        Remove all spaces from a String.
        Parameters:
        s - String to strip of blanks.
        Returns:
        String with all blanks, lead/trail/embedded removed.
      • toBookTitleCase

        public static String toBookTitleCase​(String s)
        convert to Book Title case, with first letter of each word capitalised. e.g. "handbook to HIGHER consciousness" -> "Handbook to Higher Consciousness" e.g. "THE HISTORY OF THE U.S.A." -> "The History of the U.S.A." e.g. "THE HISTORY OF THE USA" -> "The History of the Usa" (sorry about that.) Don't confuse this with Character.isTitleCase which concerns ligatures.
        Parameters:
        s - String to convert. May be any mixture of case.
        Returns:
        String with each word capitalised, except embedded words "the" "of" "to"
      • toHexString

        public static String toHexString​(int h)
        Convert int to hex with lead zeroes
        Parameters:
        h - number you want to convert to hex
        Returns:
        0x followed by unsigned hex 8-digit representation
      • toLZ

        public static String toLZ​(int i,
                                  int len)
        Convert an integer to a String, with left zeroes.
        Parameters:
        i - the integer to be converted
        len - the length of the resulting string. Warning. It will chop the result on the left if it is too long.
        Returns:
        String representation of the int e.g. 007
      • colorToString

        public static String colorToString​(Color c)
        Get #ffffff html hex number for a colour
        Parameters:
        c - Color object whose html colour number you want as a string
        Returns:
        # followed by 6 hex digits
        See Also:
        toHexString(int)
      • trimLeading

        public static String trimLeading​(String s)
        Removes white space from beginning this string.

        All characters that have codes less than or equal to '\u0020' (the space character) are considered to be white space.

        Parameters:
        s - String to process. As always the original in unchanged.
        Returns:
        this string, with leading white space removed
      • trimTrailing

        public static String trimTrailing​(String s)
        Removes white space from end this string.

        All characters that have codes less than or equal to '\u0020' (the space character) are considered to be white space.

        Parameters:
        s - String to process. As always the original in unchanged.
        Returns:
        this string, with trailing white space removed
      • equals

        public static boolean equals​(String in1,
                                     String in2)
      • getPart

        public static String getPart​(String value,
                                     int nr,
                                     String def)
        Split the string in n parts and return the part number nr. If the part is not found the default value will be returned.
        Parameters:
        value -
        nr -
        def -
        Returns:
        the part
      • getPart

        public static String getPart​(String value,
                                     int nr)
      • truncate

        public static String truncate​(String in,
                                      int length)
        This will truncate the string at the end. If the string is shorter as length it returns the string itself.
        Parameters:
        in - String to truncate
        length - Max length of the string
        Returns:
        truncated string
      • truncateNice

        public static String truncateNice​(String in,
                                          int length)
        This will truncate the string, but it also adds three dots (...) at the removed position. The truncation is not at the end at all. The resulted string is a nice representation of the original input. Use this function to display a truncated string. abc...xyz
        Parameters:
        in - String to truncate
        length - Max length of the string
        Returns:
        truncated string
      • truncateNiceLeft

        public static String truncateNiceLeft​(String in,
                                              int length)
      • getSelectedPart

        public static int[] getSelectedPart​(String text,
                                            int caretPosition)
        Search in a string the selected paragraph indicated be empty lines. If the caret position outside the string it will return null.
        Parameters:
        text - The string, must not be null
        caretPosition - Position of the caret.
        Returns:
        the position or null if the input string is null. Return is int[] {start, end}
      • getSelectedPart

        public static int[] getSelectedPart​(String text,
                                            int caretPosition,
                                            String[] separators)
      • getSelection

        public static String getSelection​(String text,
                                          int[] part,
                                          String def)
        Returns the string part of the selected part. If the part position is outside the bounds of the string it will be trimmed. If the part position is not correct or the returned string is empty then the default string is returned. Good values for the default are null or an empty string. Use this method with the result of getSelectedPart()
        Parameters:
        text - The text to crop
        part - The position in the text, first element is the begin second element the end of the selection.
        def - Return this if a selection is not possible.
        Returns:
        The selected part of the text.
      • replaceSelection

        public static String replaceSelection​(String text,
                                              int[] part,
                                              String replacement)
        Replace a text in another text.
        Parameters:
        text -
        part -
        replacement -
        Returns:
        new String
      • appendRepeating

        public static void appendRepeating​(int amount,
                                           char fill,
                                           StringBuilder buffer)
        Append the number of times a character to a string buffer.
        Parameters:
        amount - number of repeatings
        fill - char to fill
        buffer - target
      • getRepeating

        public static String getRepeating​(int amount,
                                          char fill)
        Repeat the character a given times.
        Parameters:
        amount - number of repeating
        fill - char to fill
        Returns:
        string n times the character
      • isWhitespace

        public static boolean isWhitespace​(char c)
        Return true if the character is in the list of whitespace.
        Parameters:
        c -
        Returns:
        true if character is defined as whitespace
      • countCharacters

        public static int countCharacters​(String in,
                                          char c)
        Return the count of the character in the string.
        Parameters:
        in -
        c -
        Returns:
        count of chars or 0 if 'in' is null
      • countCharacters

        public static int countCharacters​(String in,
                                          char[] c)
        Return the count of the characters in the string.
        Parameters:
        in -
        c -
        Returns:
        count of chars or 0 if 'in' is null
      • findInitials

        public static String findInitials​(String title,
                                          boolean upperOnly,
                                          boolean digits,
                                          int maxSize)
        Try to find initials out of the given title. Use the first letters after whitspaces for the initials. The returned string is not in upper letters. If you need Upper Letters append toUpper().
        Parameters:
        title - The input String
        upperOnly - Set true if only collect upper characters in title
        digits - Set true if digits (after whitespaces) should also be used.
        maxSize - Max size in characters of the initilas or 0 for no limit.
        Returns:
        The initials in mixed letters.
      • isComposedOf

        public static boolean isComposedOf​(String in,
                                           String composed)
        Check a string against all characters in another string. If the first string is not build from characters of the other one the method returns false.
        Parameters:
        in -
        composed -
        Returns:
        true if composed
      • integerPart

        public static String integerPart​(String in)
      • beforeIndexOrAll

        public static String beforeIndexOrAll​(String _s,
                                              char _c)
      • toByteDisplayString

        public static String toByteDisplayString​(long bytes)
      • regexEncode

        @Deprecated
        public static String regexEncode​(String in)
        Deprecated.
        Encode a string to be used in an regular expression. Use Pattern.quote instead !
        Parameters:
        in - String
        Returns:
        Encoded String
      • wrap

        public static String wrap​(String in,
                                  int length)
      • toHexDump

        public static String toHexDump​(byte[] bc,
                                       int lineSize)
      • toBytes

        public static byte[] toBytes​(String data)
        Return a utf-8 encoded byte array from data ignoring the VM default data set.
        Parameters:
        data -
        Returns:
        utf-8 encoded byte array
      • byteToString

        public static String byteToString​(byte[] data)
        Return a utf-8 decoded string from the data ignoring the VM default char set.
        Parameters:
        data -
        Returns:
        utf-8 decoded string
      • split

        public static String[] split​(String in,
                                     int length)
        Split string into parts after length is reached.
        Parameters:
        in -
        length -
        Returns:
        the spit string into an array
      • splitCollection

        public static Collection<String> splitCollection​(String in,
                                                         int length)
        Split string into parts after length is reached.
        Parameters:
        in -
        length -
        Returns:
        the split string into a collection
      • toString

        public static String toString​(Object val)
        Convert a object to string using deep stringify mechanisms. Will never return null, instead of null the string '[null]' will be returned.
        Parameters:
        val -
        Returns:
        The object as string
      • toStringOrNull

        public static String toStringOrNull​(Object val)
        Like toString but if the value is null the return is null.
        Parameters:
        val -
        Returns:
        The object as string or null
      • compileAndExecute

        public static String compileAndExecute​(String template,
                                               IProperties attributes)
                                        throws de.mhus.lib.errors.MException
        Throws:
        de.mhus.lib.errors.MException
      • cutAfter

        public static String cutAfter​(String in,
                                      String pattern,
                                      char fill,
                                      int size)
        Search for a pattern and cut the string after size characters. If the string is too short it will be filled with fill characters.
        Parameters:
        in - The string to cut
        pattern - The pattern to search for (not regex!)
        fill - Fill character or 0 to disable
        size - size after (or negative before) the found pattern
        Returns:
        The cutted string
      • toAscii127

        public static String toAscii127​(String in)
      • toAscii127

        public static String toAscii127​(char c)