String utf8 size in kilobytes

Discussion in 'Ruby' started by daniel wijnands, Jan 5, 2006.

  1. I have a mimemessage in a string.
    This string is utf8, i would like to know the size of this string.
    String.size gives me the length in characters, but i need the size in kb
    or bytes

    --
    Posted via http://www.ruby-forum.com/.
     
    daniel wijnands, Jan 5, 2006
    #1
    1. Advertising

  2. daniel wijnands

    Andreas S. Guest

    daniel wijnands wrote:
    > I have a mimemessage in a string.
    > This string is utf8, i would like to know the size of this string.
    > String.size gives me the length in characters, but i need the size in kb
    > or bytes


    String#size returns the size in bytes. String#jsize returns the number
    of characters (with require 'jcode').

    --
    Posted via http://www.ruby-forum.com/.
     
    Andreas S., Jan 5, 2006
    #2
    1. Advertising

  3. Thanks, then my method is valid, i want to know the bytes, so that's
    fine :)

    Andreas S. wrote:
    > daniel wijnands wrote:
    >> I have a mimemessage in a string.
    >> This string is utf8, i would like to know the size of this string.
    >> String.size gives me the length in characters, but i need the size in kb
    >> or bytes

    >
    > String#size returns the size in bytes. String#jsize returns the number
    > of characters (with require 'jcode').



    --
    Posted via http://www.ruby-forum.com/.
     
    daniel wijnands, Jan 5, 2006
    #3
    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. Michael Berg
    Replies:
    0
    Views:
    487
    Michael Berg
    May 30, 2004
  2. Tejas
    Replies:
    1
    Views:
    639
    William Ahern
    Nov 14, 2007
  3. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,661
    Michael Jung
    May 25, 2008
  4. Andrew
    Replies:
    32
    Views:
    2,026
    Arne Vajhøj
    Aug 23, 2009
  5. gry
    Replies:
    2
    Views:
    779
    Alf P. Steinbach
    Mar 13, 2012
Loading...

Share This Page