C# String.Length from Microsoft Documentation -


microsoft documentation states code return 7 characters

the length property returns number of char objects in instance, not number of unicode characters.

string characters = "abc\u0000def"; console.writeline(characters.length);    // displays 7 

i need function return result 12 because there 12 different characters. function may use?

you have prevent interpretation of literal compiler. can done @ prefix, this:

var characters = @"abc\u0000def"; 

the length property of string return 12, there no longer actual unicode character in string.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -