Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • JavaScript String Operators

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 104
    Comment on it

    Basically string is used to hold the data in text form . Mostly used operation on string is to check the length of string , to concatenate with the help of + and += ,check for substring with the help of indexOf method and extract substring with the substring method .
    Syntax ->
    String(parameter)
    new String(parameter)
    Parameter ->
    It is used to converted anything to a string .
    Now if you want to access an specific character in a string , then you can access with the help of charAt method :
    Example :

    return 'mukesh' . charAt(2); // It will return "k"
    

    Compare String With the help of strcmp() method you can compare the string .
    Example :

    var fname = "mukesh";<br>
    var lname = "Tomar"<br>
    var c =  strcmp(fname , lname); // it will return true and false<br><br>
    

    Methods In Strings :->
    1) String.fromCharCode() -> It return a string created by Unicode Values .
    2) String.length() -> It will return the length of a String .
    ' 3) String.CharAt() -> It will return the character at the specified index .
    4) String.concat() -> It will return the string after combine the text of two strings and return a new string .
    5) String.includes() -> It will return the string after finding within the another string .
    6) String.indexOf() -> It will return the index(start from the starting index) of a string.
    7) String.lastIndexOf() -> It will return the index(start from the ending index) of a string.
    8) String.match() -> To match a string it is used a regular expression against a string .
    9) String.split() -> It is used to seperate a string from original string string into an array and return a substirng .
    10) String.slice() -> It is used to extract a section of a string and return a new string .

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: