SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2004
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    another string problem

    hi,
    how can i access, for expl, to the 3rd char of a certain string?
    thanks

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Code:
    var str = "hello world";
    var thirdChar = str.charAt(2);
    Basically, take the position you want (in this case, the 3rd) and subtract 1 from that (since the counting is zero-based).

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2004
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks

    thanks again...


Bookmarks

Posting Permissions

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