JavaScript substring example

preview_player
Показать описание
Link for all dot net and sql server video tutorial playlists

Link for slides, code samples and text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

In this video we will discuss a simple real time example of where we can use indexOf(), lastIndexOf() and substring() methods

In the head section of the webform, include the following script section
function getEmailandDomainParts() {

}

Finally set the onclick attriibute of the button to call the JavaScript function
[input type="button" value="Get email & domain parts" style="width:250px"
onclick="getEmailandDomainParts()"/]

In Part 11 of JavaScript Tutorial we discussed indexOf() function. lastIndexOf() is also very useful function for manipulating strings.

lastIndexOf() method returns the position of the last occurrence of a specified value in a string. Since it's job is to return the last index of the specified value, this method searches the given string from the end to the beginning and returns the index of the first match it finds. This method returns -1 if the specified value is not present in the given string.

Example : Retrieve the last index position of dot (.) in the given string

Output : 42

Simple real time example where lastIndexOf and substring methods can be used

In the head section of the webform, include the following script section
function getDomainName()
{
}

Finally set the onclick attriibute of the button to call the JavaScript function
[input type="button" value="Get top level domain" style="width: 300px"
onclick="getDomainName()" /]
Рекомендации по теме
Комментарии
Автор

Thank you so much for making this tutorial so simple and I am following only your videos for Bootstrap, Javascipt and Angular

rukeshreddy
Автор

Can you help in this case please
Because
If I type (“textEmailAddree).value;
But the .value it’s not appear on the pop up menu

vilniusfaslan
Автор

Wat is the reason for giving .value at the end

kishoresmith
Автор

What if website domain is ".co.in" and we need ".co.in" not just ".in"

va_says_
Автор

These Videos are not playing at all
JavaScript arguments object
JavaScript Cookies
JavaScript strings and regular expressions
JavaScript substring example
Set and get multiple cookies in JavaScript

XTimNet
welcome to shbcf.ru