Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Assuming Char Represents One Character

See an example of why you should not assume that char represents only one character.


advertisement

WEBINAR:

On-Demand


Do not assume char represents only one character:

"\uD83D\uDC31".length() == 2

The escape sequence represents the Unicode code point 0x1F431 in UTF-16 as 2 chars. So even though this is only a single cat face symbol on the screen, the length() method returns 2.



   
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date