Interface JSStringFunctions

All Superinterfaces:
JSObjectFunctions
All Known Implementing Classes:
JS5String, JSString

public interface JSStringFunctions extends JSObjectFunctions
  • Method Details

    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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: