In a string in objective-c if I say something like [myStr length];
it returns a number which is the number of bytes but what can I use to return the number of characters in a string.
For example:
a string with the letter "a" in it returns a length of 1
a string with a single emoji in it returns a length of 2 (or even a length of 4 sometimes)
this is because that is the number of bytes in the string... I just need the number of characters.
%@
is just a UITextView the user types in. Where should I add the encoding to account for emoji unicode characters?userMessageCount = [[NSString stringWithFormat:@"%@", userMessageView.text] length];
– ShakerloadHTML
and then send some javascript in there to return the true string length. <--neither would be fun. – Shakeré
. – Lonnylonslesaunier