#includeusing namespace icu; int main() { UnicodeString str("Hello, world!"); UnicodeString sub = str.subString(7); // starts at index 7 std::cout << sub << std::endl; // output: "world!" return 0; }
#includeIn this example, we create a UnicodeString object "str" with the value "Hello, world!". We then use the subString function to create a new UnicodeString "sub" that starts at the 0th index and has a length of 5, which is the "Hello" part of the string. We then output the value of "sub". Package library: C++ ICU (International Components for Unicode) library.using namespace icu; int main() { UnicodeString str("Hello, world!"); UnicodeString sub = str.subString(0, 5); // starts at index 0 and has length 5 std::cout << sub << std::endl; // output: "Hello" return 0; }