JS in built-in objects

Source: Internet
Author: User

JavaScript charAt () function String.charat (n)--Returns the character of the specified position (n)
    • Char is the abbreviation for character, Chinese "symbol, character"
    • Citation URL: http://www.dreamdu.com/javascript/string.charAt/
Charat function syntax
String.charat (n);

Charat function parameters
    • N-the position of the character in the string (the position of the first character of the string is 0)
Charat function return value
    • Returns the character of n position

  • If n is not between 0 and String.length-1, an empty string is returned
  • JavaScript indexOf () function string.indexof (substring, startpos)--Returns the position of substring in string
      • Index, Chinese "indexed"
      • Citation URL: http://www.dreamdu.com/javascript/string.indexOf/
    indexof function syntax
    String.IndexOf (substring, startpos);
    indexof function parameters
      • SUBSTRING--substring to find
      • Startpos--optional parameter, starting from the startpos position of string to find substring, if no this parameter will be found from the beginning of the string
    indexof function return value
    • Returns the position of a substring substring in a string
    • No substring found in string substring, return-1
    • JavaScript lastIndexOf () function string.lastindexof (substring, startpos)--Returns the position where the substring last matched (appeared) in a string
        • Last, Chinese "final, end"
        • Citation URL: http://www.dreamdu.com/javascript/string.lastIndexOf/
      LastIndexOf function syntax
      String.LastIndexOf (substring, startpos);

      LastIndexOf function parameters
        • SUBSTRING--substring to find
        • Startpos--optional parameter, starting from the startpos position of string to find substring, if no this parameter will be found from the beginning of the string
      LastIndexOf function return value
        • Returns the position of the substring substring the last match in a string
        • No substring found in string substring, return-1

      JavaScript substring () function string.substring (startpos, Endpos)--Returns a string from the startpos position of string to the Endpos position
        • substring, Chinese "substring"
        • Citation URL: http://www.dreamdu.com/javascript/string.substring/
      substring function syntax
      String.substring (Startpos, endpos);

      substring function parameters
        • Startpos--Start position
        • Endpos--End position
      substring function return value

      String

      JavaScript substr () function string.substr (startpos, length)--Returns a string of length from the startpos position of the string
        • does not conform to the ECMA standard and is not in favor of use.
        • substr, Chinese "substring"
        • Citation URL: http://www.dreamdu.com/javascript/string.substr/
      substr function syntax
      String.substr (startpos, length);

      substr function parameters
        • Startpos--Start position (calculated from the end of the string when negative numbers are taken)
        • Length--Lengths
      substr function return value

      String

      JavaScript toLowerCase () function string.tolowercase ()--Returns a lowercase string
        • lowercase, chinese "lowercase"
        • Citation URL: http://www.dreamdu.com/javascript/string.toLowerCase/
      toLowerCase function syntax
      String.tolowercase ();

      toLowerCase function return value

      Returns a lowercase string

      JavaScript touppercase () function string.touppercase ()--Returns an uppercase string
        • uppercase, Chinese "uppercase"
        • Citation URL: http://www.dreamdu.com/javascript/string.toUpperCase/
      toUpperCase function syntax
      String.touppercase ();

      toUpperCase function return value

      Uppercase string

      toUpperCase Function Example
      var str = "www.dreamdu.com";d Ocument.write (Str.touppercase ());

      Results:

      WWW.DREAMDU.COM


JS in built-in objects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.