ICU-1267 add UnicodeString::countChar32()
X-SVN-Rev: 6197
This commit is contained in:
parent
0df9c9daf8
commit
6fb93470d2
@ -1390,6 +1390,21 @@ public:
|
||||
*/
|
||||
inline int32_t length(void) const;
|
||||
|
||||
/**
|
||||
* Count Unicode code points in the length UChar code units of the string.
|
||||
* A code point may occupy either one or two UChar code units.
|
||||
* Counting code points involves reading all code units.
|
||||
*
|
||||
* This functions is basically the inverse of moveIndex32().
|
||||
*
|
||||
* @param start the index of the first code unit to check
|
||||
* @param length the number of UChar code units to check
|
||||
* @return the number of code points in the specified code units
|
||||
* @draft ICU 2.0
|
||||
*/
|
||||
int32_t
|
||||
countChar32(UTextOffset start=0, int32_t length=0x7fffffff) const;
|
||||
|
||||
/**
|
||||
* Determine if this string is empty.
|
||||
* @return TRUE if this string contains 0 characters, FALSE otherwise.
|
||||
|
@ -675,6 +675,13 @@ UnicodeString::getChar32At(UTextOffset offset) const {
|
||||
return char32At(offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnicodeString::countChar32(UTextOffset start, int32_t length) const {
|
||||
pinIndices(start, length);
|
||||
// if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for NULL
|
||||
return u_countChar32(fArray+start, length);
|
||||
}
|
||||
|
||||
UTextOffset
|
||||
UnicodeString::moveIndex32(UTextOffset index, int32_t delta) const {
|
||||
// pin index
|
||||
|
Loading…
Reference in New Issue
Block a user