nsACString str("hello world"); int len = str.Length(); // len = 11
nsACString str("unicode \u00A9 test"); int len = str.Length(); // len = 16This example demonstrates how Length() works with non-ASCII characters. The string "unicode © test" is stored in an nsACString object, and Length() is called to get the length of the string in bytes. Despite the fact that the string contains a Unicode character (the copyright symbol), the result is still 16, indicating that the string is 16 bytes long. The nsACString class is part of the Mozilla Firefox source code, specifically the xpcom package.