• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Number of chars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Number of chars


  • Subject: Re: Number of chars
  • From: Luther Baker <email@hidden>
  • Date: Thu, 21 Mar 2013 03:48:51 -0500

I don't think your example makes sense. How is 'num of char of "test"' ever 3?

In a particular string representation, all letters are each, generally represented with the same number of bytes.

On Mar 21, 2013, at 3:27 AM, Luca Ciciriello <email@hidden> wrote:

> Hi all.
> I'm using in my iOS project some Objective-C++ modules. Here I have some conversion from NSString to C++11 std::string. After this conversion I found (correctly) in my std::string some 2-byte characters.
> My question is: How can I count the number of chars and not the numbers of byte in my std::string?
>
> Example.
>
> if my std::string test contains 2 1-byte chars and 1 2-byte (UNICODE) char, I have:
>
> num of char of "test" = 3
> num of byte (test.size()) of "test" = 4
>
> Luca.
>
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Number of chars
      • From: Luca Ciciriello <email@hidden>
References: 
 >Number of chars (From: Luca Ciciriello <email@hidden>)

  • Prev by Date: Number of chars
  • Next by Date: Re: Number of chars
  • Previous by thread: Number of chars
  • Next by thread: Re: Number of chars
  • Index(es):
    • Date
    • Thread