Class STRINGImpl<C extends IComponent<C>>

    • Constructor Detail

      • STRINGImpl

        public STRINGImpl​(C context)
    • Method Detail

      • itoa

        public String itoa​(int i)
        Description copied from interface: STRING
        Convert an integer to a string.
        Specified by:
        itoa in interface STRING
        Parameters:
        i - the integer to convert
        Returns:
        the string representation of the input integer
      • atoi

        public int atoi​(String s)
                 throws XtumlException
        Description copied from interface: STRING
        Convert a string to an integer.
        Specified by:
        atoi in interface STRING
        Parameters:
        s - the string to parse
        Returns:
        the integer representation of the input string
        Throws:
        XtumlException - if the string cannot be parsed to an integer.
      • substr

        public String substr​(String s,
                             int begin,
                             int end)
        Description copied from interface: STRING
        Get a substring of an input string from begin (inclusive) to end (exclusive). If begin < 0, the result is a substring starting at the beginning of s. If begin > the length of s - 1, the result is an empty string. If end < 0 or > the length of s, the result is a substring starting at begin to the end of s. If end <= begin, the result is an empty string.
        Specified by:
        substr in interface STRING
        Parameters:
        s - the input string
        begin - the start index of the substring (inclusive)
        end - the end index of the substring (exclusive)
        Returns:
        the substring of s from begin (inclusive) to end (exclusive)
      • strlen

        public int strlen​(String s)
        Description copied from interface: STRING
        Get the length of a string
        Specified by:
        strlen in interface STRING
        Parameters:
        s - the input string
        Returns:
        the length of the input string
      • indexof

        public int indexof​(String haystack,
                           String needle)
        Description copied from interface: STRING
        Gets the index of the first occurance of needle in haystack. Returns -1 if needle is not contained in haystack.
        Specified by:
        indexof in interface STRING
        Parameters:
        haystack - the string to search
        needle - the string pattern to search for
        Returns:
        the index of the first occurance of needle in haystack
      • trim

        public String trim​(String s)
        Description copied from interface: STRING
        Trim whitespace from the start and end of a string.
        Specified by:
        trim in interface STRING
        Parameters:
        s - the input string
        Returns:
        the input string with all leading and trailing whitespace removed.
      • quote

        public String quote()
        Description copied from interface: STRING
        Return a literal double quote.
        Specified by:
        quote in interface STRING
        Returns:
        a literal double quote
      • escapetics

        public String escapetics​(String s)
        Description copied from interface: STRING
        Replace all single quotes with two single quotes for escaping SQL insert statements.
        Specified by:
        escapetics in interface STRING
        Parameters:
        s - the input string
        Returns:
        the input string with all single quotes replaced with two single quotes
      • unescapetics

        public String unescapetics​(String s)
        Description copied from interface: STRING
        Replace all occurances of two adjacent single quotes with one single quote for unescaping SQL insert statements.
        Specified by:
        unescapetics in interface STRING
        Parameters:
        s - the input string
        Returns:
        the input string with all occurances of two adjacent single quotes replaced with one single quote