Javascript Substring

The Javascript substring function is very similar to that of PHP. The first parameter is the start position and the second parameter is the end position. The first character in a javascript string is position 0.

Here is a simple example:

JAVASCRIPT:
  1. var birthday = '1978-07-11'
  2. var year = birthday.substring(0,4)
  3. var month = birthday.substring(5,7)
  4. var day = birthday.substring(8,10)

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank

Home | JavaScript | Javascript Substring