Interface JSStringFunctions

    • Method Detail

      • charAt

        JSString charAt​(JSNumber position)
        function charAt(position) get the nth character from a string.
        Parameters:
        position - The index of the character that should be returned from string.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String, charCodeAt(), indexOf(), lastIndexOf()
      • charCodeAt

        JSNumber charCodeAt​(JSNumber position)
        function charCodeAt(position) get the nth character code from a string.
        Parameters:
        position - The index of the character whose encoding is to be returned.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String, charAt()
      • concat

        JSString concat​(JSString value)
        function concat(value1, ...) concatenate strings
        Parameters:
        value - one or more values to be concatenated to string.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • indexOf

        JSNumber indexOf​(JSString searchString,
                         JSNumber startPosition)
        function indexOf(searchString, startPosition) search a string.
        Parameters:
        searchString - The substring to be search within string.
        startPosition - Optional start index.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • lastIndexOf

        JSNumber lastIndexOf​(JSString searchString,
                             JSNumber startPosition)
        function lastIndexOf(searchString, startPosition) search a string backward.
        Parameters:
        searchString - The substring to be search within string.
        startPosition - Optional start index.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • localeCompare

        JSNumber localeCompare​(JSString otherString)
        function localeCompare(otherString) compare one string to another, using locale-specific ordering.

        Example

         var string;//array of string initialised somewhere
         strings.sort(function(a,b){return a.localCompare(b);});
         
        Parameters:
        otherString - A string to be compared, in a locale-sensitive fashion, with string.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • match

        JSString match​(JSRegExp regexp)
        function match(regexp) find one or more regular-expression matches
        Parameters:
        regexp - A RegExp object that specifies the pattern to be matched.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • replace

        JSString replace​(JSRegExp regexp,
                         JSString replaceValue)
        function replace(regexp, replaceValue) replace substring(s) matching a regular expression.
        Parameters:
        regexp - A RegExp object that specifies the pattern to be replaced.
        replaceValue - A string that specifies the replacement text.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • search

        JSNumber search​(JSRegExp regexp)
        function search(regexp) search for a regular expression
        Parameters:
        regexp - A RegExp object that specifies the pattern to be searched.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • slice

        JSString slice​(JSNumber start,
                       JSNumber end)
        function slice(start, end) extract a substring.

        Example

         var s = "abcdefg";
         s.slice(0,4); //returns "abcd"
         s.slice(2,4); //returns "cd"
         s.slice(4); //returns "efg"
         s.slice(3, -1); //returns "def"
         s.slice(3,-2); //returns "de"
         
        Parameters:
        start - The start index where the slice if to begin.
        end - Optional end index where the slice is to end.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • split

        JSArray split​(JSString separator,
                      JSNumber limit)
        function split(separator, limit) break a string into an array of strings.

        Example

         "1|2|3|4".split("|"); //returns ["1","2","3","4"]
         "%1%2%3%4%".split("%"); //returns ["","1","2","3","4",""]
         
        Parameters:
        separator - The string or regular expression at which the string splits
        limit - Optional value that specifies the maximum length of the returned array.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • substring

        JSString substring​(JSNumber from,
                           JSNumber to)
        function substring(from, to) return a substring of a string.
        Parameters:
        from - The index where to start the extraction. First character is at index 0
        to - Optional. The index where to stop the extraction. If omitted, it extracts the rest of the string
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • toLowerCase

        JSString toLowerCase()
        function toLowerCase() Converts a string to lower case.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String, charAt(), indexOf(), lastIndexOf()
      • toLocaleLowerCase

        JSString toLocaleLowerCase()
        function toLocaleLowerCase() Converts a string to lower case.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String, toLocaleUpperCase()
      • toUpperCase

        JSString toUpperCase()
        function toUpperCase() Converts a string to upper case.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String
      • toLocaleUpperCase

        JSString toLocaleUpperCase()
        function toLocaleUpperCase() Converts a string to upper case.
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        String