|We can use charAt to extract a character from a string at a
given position. We can extract a string from a bigger string by using substring. If we
know the position of a string then we can extract it.
position 3 and position 6 is 'def'. Therefore we can use:
to extract our string.
At first this seems a bit pointless and useless, but we can use this for a variety of
purposes. However, first we need to check whether our string is in the big string. To do
this we can use indexOf(). When we can do that, we can perform some useful tricks! Bear
with me until we have looked at indexOf()!
The code for this page is:
Java Script Tutorial - Strings substrings - How to extract a string from a
document.write('This was written by
document.write('The result of \'abcdefgh\'.subString\(3,6\)
Next: Finding out if a string is in a bigger one!