#includeusing namespace std; using namespace icu; int main() { UnicodeString str = UnicodeString("Hello World!"); int size = str.length(); cout << "Size of str is " << size << endl; return 0; }
#includeIn this example, we create a UnicodeString object and initialize it with the value "Bonjour le Monde!". We then get the size of the string using the countChar32() function of the UnicodeString class and print it to the console. Both examples are using the ICU library, which provides support for Unicode and globalisation.using namespace std; using namespace icu; int main() { UnicodeString str = UnicodeString("Bonjour le Monde!"); int size = str.countChar32(); cout << "Size of str is " << size << endl; return 0; }