]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/testutil.cpp
2 **********************************************************************
3 * Copyright (C) 2001, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 05/23/00 aliu Creation.
8 **********************************************************************
11 #include "unicode/unistr.h"
14 static const UChar HEX
[16]={48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70};
16 UnicodeString
TestUtility::hex(UChar ch
) {
18 buf
.append(HEX
[0xF&(ch
>>12)]);
19 buf
.append(HEX
[0xF&(ch
>>8)]);
20 buf
.append(HEX
[0xF&(ch
>>4)]);
21 buf
.append(HEX
[0xF&ch
]);
25 UnicodeString
TestUtility::hex(const UnicodeString
& s
) {
26 return hex(s
, 44 /*,*/);
29 UnicodeString
TestUtility::hex(const UnicodeString
& s
, UChar sep
) {
30 if (s
.length() == 0) return "";
31 UnicodeString result
= hex(s
.charAt(0));
32 for (int32_t i
= 1; i
< s
.length(); ++i
) {
34 result
.append(hex(s
.charAt(i
)));