mb_strlen (php) for ASP

Discussion in 'ASP General' started by ssr92, Jul 10, 2008.

  1. ssr92

    ssr92 Guest

    Hi,
    I need to a function that performs the same task than mb_strlen (in php)?
    Any help ?
     
    ssr92, Jul 10, 2008
    #1
    1. Advertising

  2. ssr92

    Old Pedant Guest

    First of all, ASP isn't a language. So it doesn't have *ANY* coding functions.

    You code ASP in either VBScript or JScript (or, if you can find a copy from
    7 or 8 years ago, PerlScript).

    In either VBScript or JScript, though, the question is a non-sequitir.

    The PHP function mb_strlen is for use with Multi-Byte strings (e.g., UTF-8)
    and neither VBS nor JS suport them. Both use *ONLY* Unicode strings (that
    is, where each character is *ALWAYS* two bytes long). So the standard string
    length functions would always give you the same answer that mb_strlen( )
    would give you, if it were applicable.

    VBScript: LEN(str)
    JScript: str.length

    NOTE: VBScript *does* allow you to get the length of a string in bytes,
    using
    LENB(str)
    but it's always 2 * LEN(str) so not useful in determining how many 2-byte
    UTF-8 characters there would be in the string if you could convert it to
    UTF-8.
     
    Old Pedant, Jul 10, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ted Zeng
    Replies:
    4
    Views:
    529
    Tim Arnold
    Oct 3, 2006
  2. Ted Zeng
    Replies:
    0
    Views:
    651
    Ted Zeng
    Oct 13, 2006
  3. torque63
    Replies:
    0
    Views:
    633
    torque63
    Jan 1, 2009
  4. raviraj joshi
    Replies:
    0
    Views:
    333
    raviraj joshi
    Jul 4, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    1,943
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page