SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Degrading Gracefully PalmerB's Avatar
    Join Date
    Sep 2001
    Location
    Ohio - U.S.A. Outlook: Cautiously Optimistic
    Posts
    3,283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Character length in string...

    I'm learning JavaScript and I'm getting an "undefined" error. I understand the reason behind this is the length of a string is 250 characters. My question is, does a space count as a character. In other words how many characters are in this sentence...

    SitePoint is cool

    17 or 15?

    Thanks,
    Palmer

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Type this into your Address: javascript:alert("SitePoint is cool".length);
    ck :: bringing chris to the masses.

  3. #3
    SitePoint Addict Drinky's Avatar
    Join Date
    Jan 2001
    Location
    England
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The space character is a caracter and is therefore counted in the length of a string.
    Drinky


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
  •