javascript help???

Results 1 to 2 of 2

Thread: javascript help???

  1. #1
    newtoo Guest

    Default javascript help???

    okay, is there an already built in functions for strings in javascript? is there away for me to pick of the first 2 letters of a word to check for a value?? i&#039m just not sure how to do this in javascript. i know i could do it in asp, but that is not on the server, so i can&#039t use that.<BR><BR>thanks.

  2. #2
    Joel N Guest

    Default RE: javascript help???

    From Microsoft&#039s JScript documentation comes the following example:<BR><BR>function SubstrDemo()<BR>{<BR> var s, ss;<BR> var s = "The quick brown fox jumped over the lazy yellow dog.";<BR> ss = s.substr(16, 3);<BR> // Returns "fox".<BR> return(ss);<BR>}<BR><BR><BR>Just remember that the &#039 16&#039 is ZERO based so this example actually starts on the 17th character which is the &#039f&#039 in &#039fox&#039. To grab the first two characters you would use<BR> ss = s.substr(0, 2);<BR>which in this example would return &#039Th&#039<BR><BR><BR>HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts