substr: Part of JavaScript string

var my_str="Welcome to"
The output will be come to

Now let us specify the total value and see the output.
var my_str="Welcome to"
The output will be come to

You can see we got the output from the 3rd position till we get required 7 chars.
We can collect part of a string by using substr JavaScript string function. Here we can supply start location and total number of char from the start location ( optional ) of the string and we can get the total string within these start and total values.

Here is the syntax
start_value and total_value are optional.

If both values are not given the full string is returned.

We can collect the domain part or the userid part of an email address by using this function. userid and domain part of an email address using substr Part of string by using start and end location
JavaScript String Reference substring()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer