#includeusing namespace icu; int main() { UnicodeString myString("Hello World"); UnicodeString subString; myString.extract(0, 5, subString); std::cout << subString << std::endl; // Output: Hello return 0; }
#includeIn this example, a Unicode string "Привет мир" is created, which means "Hello World" in Russian. A substring starting from the index 0 and having a length of 6 characters (which includes a Cyrillic letter) is extracted using the extract function. The resulting substring "Привет" is then printed to the console. Package library: C++ ICU library.using namespace icu; int main() { UnicodeString myString("Привет мир"); // Russian for "Hello World" UnicodeString subString; myString.extract(0, 6, subString); std::cout << subString << std::endl; // Output: Привет return 0; }