本文整理汇总了C++中UnicodeString::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::remove方法的具体用法?C++ UnicodeString::remove怎么用?C++ UnicodeString::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rt
//.........这里部分代码省略.........
"\\ube44\\uc601\\ub9ac", "\\uc870\\uc9c1\\uc73c\\ub85c\\uc11c", "\\ud604\\ub300",
"\\uc18c\\ud504\\ud2b8\\uc6e8\\uc5b4", "\\uc81c\\ud488\\uacfc",
"\\ud45c\\uc900\\uc5d0\\uc11c", "\\ud14d\\uc2a4\\ud2b8\\uc758", "\\ud45c\\ud604\\uc744",
"\\uc9c0\\uc815\\ud558\\ub294", "\\uc720\\ub2c8\\ucf54\\ub4dc", "\\ud45c\\uc900\\uc758",
"\\uc0ac\\uc6a9\\uc744", "\\uac1c\\ubc1c\\ud558\\uace0", "\\ud655\\uc7a5\\ud558\\uba70",
"\\uc7a5\\ub824\\ud558\\uae30", "\\uc704\\ud574",
"\\uc138\\uc6cc\\uc84c\\uc2b5\\ub2c8\\ub2e4.", "\\ucf58\\uc18c\\uc2dc\\uc5c4",
"\\uba64\\ubc84\\uc27d\\uc740", "\\ucef4\\ud4e8\\ud130\\uc640", "\\uc815\\ubcf4",
"\\ucc98\\ub9ac", "\\uc0b0\\uc5c5\\uc5d0", "\\uc885\\uc0ac\\ud558\\uace0", "\\uc788\\ub294",
"\\uad11\\ubc94\\uc704\\ud55c", "\\ud68c\\uc0ac", "\\ubc0f", "\\uc870\\uc9c1\\uc758",
"\\ubc94\\uc704\\ub97c",
"\\ub098\\ud0c0\\ub0c5\\ub2c8\\ub2e4.", "\\ucf58\\uc18c\\uc2dc\\uc5c4\\uc758",
"\\uc7ac\\uc815\\uc740", "\\uc804\\uc801\\uc73c\\ub85c", "\\ud68c\\ube44\\uc5d0",
"\\uc758\\ud574", "\\ucda9\\ub2f9\\ub429\\ub2c8\\ub2e4.", "\\uc720\\ub2c8\\ucf54\\ub4dc",
"\\ucee8\\uc18c\\uc2dc\\uc5c4\\uc5d0\\uc11c\\uc758", "\\uba64\\ubc84\\uc27d\\uc740",
"\\uc804", "\\uc138\\uacc4", "\\uc5b4\\ub290", "\\uacf3\\uc5d0\\uc11c\\ub098",
"\\uc720\\ub2c8\\ucf54\\ub4dc", "\\ud45c\\uc900\\uc744", "\\uc9c0\\uc6d0\\ud558\\uace0",
"\\uadf8", "\\ud655\\uc7a5\\uacfc", "\\uad6c\\ud604\\uc744",
"\\uc9c0\\uc6d0\\ud558\\uace0\\uc790\\ud558\\ub294", "\\uc870\\uc9c1\\uacfc",
"\\uac1c\\uc778\\uc5d0\\uac8c", "\\uac1c\\ubc29\\ub418\\uc5b4",
"\\uc788\\uc2b5\\ub2c8\\ub2e4.",
"\\ub354", "\\uc790\\uc138\\ud55c", "\\ub0b4\\uc6a9\\uc740", "\\uc6a9\\uc5b4\\uc9d1,",
"\\uc608\\uc81c", "\\uc720\\ub2c8\\ucf54\\ub4dc", "\\uc0ac\\uc6a9", "\\uac00\\ub2a5",
"\\uc81c\\ud488,", "\\uae30\\uc220", "\\uc815\\ubcf4", "\\ubc0f", "\\uae30\\ud0c0",
"\\uc720\\uc6a9\\ud55c", "\\uc815\\ubcf4\\ub97c",
"\\ucc38\\uc870\\ud558\\uc2ed\\uc2dc\\uc624."
};
enum { WHAT_IS_UNICODE_length = UPRV_LENGTHOF(WHAT_IS_UNICODE) };
UParseError parseError;
UErrorCode status = U_ZERO_ERROR;
Transliterator* latinJamo = Transliterator::createInstance("Latin-Jamo", UTRANS_FORWARD, parseError, status);
Transliterator* jamoHangul = Transliterator::createInstance("NFC(NFD)", UTRANS_FORWARD, parseError, status);
if (latinJamo == 0 || jamoHangul == 0 || U_FAILURE(status)) {
delete latinJamo;
delete jamoHangul;
dataerrln("FAIL: createInstance returned NULL - %s", u_errorName(status));
return;
}
Transliterator* jamoLatin = latinJamo->createInverse(status);
Transliterator* hangulJamo = jamoHangul->createInverse(status);
if (jamoLatin == 0 || hangulJamo == 0) {
errln("FAIL: createInverse returned NULL");
delete latinJamo;
delete jamoLatin;
delete jamoHangul;
delete hangulJamo;
return;
}
Transliterator* tarray[4] =
{ hangulJamo, jamoLatin, latinJamo, jamoHangul };
CompoundTransliterator rt(tarray, 4);
UnicodeString buf;
int32_t total = 0;
int32_t errors = 0;
int32_t i;
for (i=0; i < WHAT_IS_UNICODE_length; ++i) {
++total;
UnicodeString hangul = UnicodeString(WHAT_IS_UNICODE[i], -1, US_INV);
hangul = hangul.unescape(); // Parse backslash-u escapes
UnicodeString hangulX = hangul;
rt.transliterate(hangulX);
if (hangul != hangulX) {
++errors;
UnicodeString jamo = hangul; hangulJamo->transliterate(jamo);
UnicodeString latin = jamo; jamoLatin->transliterate(latin);
UnicodeString jamo2 = latin; latinJamo->transliterate(jamo2);
UnicodeString hangul2 = jamo2; jamoHangul->transliterate(hangul2);
buf.remove(0);
buf.append("FAIL: ");
if (hangul2 != hangulX) {
buf.append((UnicodeString)"(Weird: " + hangulX + " != " + hangul2 + ")");
}
// The Hangul-Jamo conversion is not usually the
// bug here, so we hide it from display.
// Uncomment lines to see the Hangul.
buf.append(//hangul + " => " +
jamoToName(jamo) + " => " +
latin + " => " + jamoToName(jamo2)
//+ " => " + hangul2
);
errln(prettify(buf));
}
}
if (errors != 0) {
errln((UnicodeString)"Test word failures: " + errors + " out of " + total);
} else {
logln((UnicodeString)"All " + total + " test words passed");
}
delete latinJamo;
delete jamoLatin;
delete jamoHangul;
delete hangulJamo;
}
示例2: Hashtable
void
PluralFormat::applyPattern(const UnicodeString & newPattern, UErrorCode & status)
{
if (U_FAILURE(status))
{
return;
}
this->pattern = newPattern;
UnicodeString token;
int32_t braceCount = 0;
fmtToken type;
UBool spaceIncluded = FALSE;
if (fParsedValuesHash == NULL)
{
fParsedValuesHash = new Hashtable(TRUE, status);
if (U_FAILURE(status))
{
return;
}
fParsedValuesHash->setValueDeleter(deleteHashStrings);
}
UBool getKeyword = TRUE;
UnicodeString hashKeyword;
UnicodeString * hashPattern;
for (int32_t i = 0; i < pattern.length(); ++i)
{
UChar ch = pattern.charAt(i);
if (!inRange(ch, type))
{
if (getKeyword)
{
status = U_ILLEGAL_CHARACTER;
return;
}
else
{
token += ch;
continue;
}
}
switch (type)
{
case tSpace:
if (token.length() == 0)
{
continue;
}
if (getKeyword)
{
// space after keyword
spaceIncluded = TRUE;
}
else
{
token += ch;
}
break;
case tLeftBrace:
if (getKeyword)
{
if (fParsedValuesHash->get(token) != NULL)
{
status = U_DUPLICATE_KEYWORD;
return;
}
if (token.length() == 0)
{
status = U_PATTERN_SYNTAX_ERROR;
return;
}
if (!pluralRules->isKeyword(token))
{
status = U_UNDEFINED_KEYWORD;
return;
}
hashKeyword = token;
getKeyword = FALSE;
token.remove();
}
else
{
if (braceCount == 0)
{
status = U_UNEXPECTED_TOKEN;
return;
}
else
{
token += ch;
}
}
braceCount++;
spaceIncluded = FALSE;
break;
case tRightBrace:
if (getKeyword)
//.........这里部分代码省略.........
示例3: greg
//.........这里部分代码省略.........
if (limits[j][0] > minActual) {
// the minimum
limits[j][0] = minActual;
}
if (limits[j][1] < minActual) {
// the greatest minimum
limits[j][1] = minActual;
}
if (limits[j][2] > maxActual) {
// the least maximum
limits[j][2] = maxActual;
}
if (limits[j][3] < maxActual) {
// the maximum
limits[j][3] = maxActual;
}
if (minActual < minLow || minActual > minHigh) {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" Range for min of " + FIELD_NAME[f] + "(" + f +
")=" + minLow + ".." + minHigh +
", actual_min=" + minActual);
}
if (maxActual < maxLow || maxActual > maxHigh) {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" Range for max of " + FIELD_NAME[f] + "(" + f +
")=" + maxLow + ".." + maxHigh +
", actual_max=" + maxActual);
}
if (v < minActual || v > maxActual) {
// timebomb per #9967, fix with #9972
if ( uprv_strcmp(cal.getType(), "dangi") == 0 &&
testMillis >= 1865635198000.0 &&
logKnownIssue("9972", "as per #9967")) { // Feb 2029 gregorian, end of dangi 4361
logln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" " + FIELD_NAME[f] + "(" + f + ")=" + v +
", actual=" + minActual + ".." + maxActual +
", allowed=(" + minLow + ".." + minHigh + ")..(" +
maxLow + ".." + maxHigh + ")");
} else {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" " + FIELD_NAME[f] + "(" + f + ")=" + v +
", actual=" + minActual + ".." + maxActual +
", allowed=(" + minLow + ".." + minHigh + ")..(" +
maxLow + ".." + maxHigh + ")");
}
}
}
greg.add(UCAL_DAY_OF_YEAR, 1, status);
if (failure(status, "Calendar::add")) {
return;
}
}
// Check actual maxima and minima seen against ranges returned
// by API.
UnicodeString buf;
for (j = 0; fieldsToTest[j] >= 0; ++j) {
int32_t rangeLow, rangeHigh;
UBool fullRangeSeen = TRUE;
UCalendarDateFields f = (UCalendarDateFields)fieldsToTest[j];
buf.remove();
buf.append((UnicodeString)"[" + cal.getType() + "] " + FIELD_NAME[f]);
// Minumum
rangeLow = cal.getMinimum(f);
rangeHigh = cal.getGreatestMinimum(f);
if (limits[j][0] != rangeLow || limits[j][1] != rangeHigh) {
fullRangeSeen = FALSE;
}
buf.append((UnicodeString)" minima range=" + rangeLow + ".." + rangeHigh);
buf.append((UnicodeString)" minima actual=" + limits[j][0] + ".." + limits[j][1]);
// Maximum
rangeLow = cal.getLeastMaximum(f);
rangeHigh = cal.getMaximum(f);
if (limits[j][2] != rangeLow || limits[j][3] != rangeHigh) {
fullRangeSeen = FALSE;
}
buf.append((UnicodeString)" maxima range=" + rangeLow + ".." + rangeHigh);
buf.append((UnicodeString)" maxima actual=" + limits[j][2] + ".." + limits[j][3]);
if (fullRangeSeen) {
logln((UnicodeString)"OK: " + buf);
} else {
// This may or may not be an error -- if the range of dates
// we scan over doesn't happen to contain a minimum or
// maximum, it doesn't mean some other range won't.
logln((UnicodeString)"Warning: " + buf);
}
}
logln((UnicodeString)"End: " + greg.getTime(status));
}
示例4: markAsSet
inline void markAsSet() {
prefix.remove();
}
示例5: Hashtable
//.........这里部分代码省略.........
return;
}//end of switch(type)
break;
//Handle the keyword state
case keywordState:
switch (type) {
case tSpace:
state = pastKeywordState;
break;
case tStartKeyword:
case tContinueKeyword:
keyword += ch;
break;
case tLeftBrace:
state = phraseState;
break;
//If anything else is encountered, it's a syntax error
default:
status = U_PATTERN_SYNTAX_ERROR;
return;
}//end of switch(type)
break;
//Handle the pastkeyword state
case pastKeywordState:
switch (type) {
case tSpace:
break;
case tLeftBrace:
state = phraseState;
break;
//If anything else is encountered, it's a syntax error
default:
status = U_PATTERN_SYNTAX_ERROR;
return;
}//end of switch(type)
break;
//Handle the phrase state
case phraseState:
switch (type) {
case tLeftBrace:
braceCount++;
phrase += ch;
break;
case tRightBrace:
//Matching keyword, phrase pair found
if (braceCount == 0){
//Check validity of keyword
if (parsedValuesHash->get(keyword) != NULL) {
status = U_DUPLICATE_KEYWORD;
return;
}
if (keyword.length() == 0) {
status = U_PATTERN_SYNTAX_ERROR;
return;
}
//Store the keyword, phrase pair in hashTable
ptrPhrase = new UnicodeString(phrase);
parsedValuesHash->put( keyword, ptrPhrase, status);
//Reinitialize
keyword.remove();
phrase.remove();
ptrPhrase = NULL;
state = startState;
}
if (braceCount > 0){
braceCount-- ;
phrase += ch;
}
break;
default:
phrase += ch;
}//end of switch(type)
break;
//Handle the default case of switch(state)
default:
status = U_PATTERN_SYNTAX_ERROR;
return;
}//end of switch(state)
}
//Check if the state machine is back to startState
if ( state != startState){
status = U_PATTERN_SYNTAX_ERROR;
return;
}
//Check if "other" keyword is present
if ( !checkSufficientDefinition() ) {
status = U_DEFAULT_KEYWORD_MISSING;
}
return;
}
示例6: run
//.........这里部分代码省略.........
int32_t iteration;
status = U_ZERO_ERROR;
LocalPointer<NumberFormat> formatter(NumberFormat::createInstance(Locale::getEnglish(),status));
if(U_FAILURE(status)) {
IntlTest::gTest->dataerrln("%s:%d Error %s on NumberFormat::createInstance().",
__FILE__, __LINE__, u_errorName(status));
goto cleanupAndReturn;
}
percentFormatter.adoptInstead(NumberFormat::createPercentInstance(Locale::getFrench(),status));
if(U_FAILURE(status)) {
IntlTest::gTest->errln("%s:%d Error %s on NumberFormat::createPercentInstance().",
__FILE__, __LINE__, u_errorName(status));
goto cleanupAndReturn;
}
for(iteration = 0;!IntlTest::gTest->getErrors() && iteration<kFormatThreadIterations;iteration++)
{
int32_t whichLine = (iteration + fOffset)%kNumberFormatTestDataLength;
UnicodeString output;
formatter->format(kNumberFormatTestData[whichLine].number, output);
if(0 != output.compare(kNumberFormatTestData[whichLine].string)) {
IntlTest::gTest->errln("format().. expected " + kNumberFormatTestData[whichLine].string
+ " got " + output);
goto cleanupAndReturn;
}
// Now check percent.
output.remove();
whichLine = (iteration + fOffset)%kPercentFormatTestDataLength;
percentFormatter->format(kPercentFormatTestData[whichLine].number, output);
if(0 != output.compare(kPercentFormatTestData[whichLine].string))
{
IntlTest::gTest->errln("percent format().. \n" +
showDifference(kPercentFormatTestData[whichLine].string,output));
goto cleanupAndReturn;
}
// Test message error
const int kNumberOfMessageTests = 3;
UErrorCode statusToCheck;
UnicodeString patternToCheck;
Locale messageLocale;
Locale countryToCheck;
double currencyToCheck;
UnicodeString expected;
// load the cases.
switch((iteration+fOffset) % kNumberOfMessageTests)
{
default:
case 0:
statusToCheck= U_FILE_ACCESS_ERROR;
patternToCheck= "0:Someone from {2} is receiving a #{0}"
" error - {1}. Their telephone call is costing "
"{3,number,currency}."; // number,currency
messageLocale= Locale("en","US");
countryToCheck= Locale("","HR");
currencyToCheck= 8192.77;
示例7: parse
UXMLElement *
UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
char bytes[4096], charsetBuffer[100];
FileStream *f;
const char *charset, *pb;
UnicodeString src;
UConverter *cnv;
UChar *buffer, *pu;
int32_t fileLength, bytesLength, length, capacity;
UBool flush;
if(U_FAILURE(errorCode)) {
return NULL;
}
f=T_FileStream_open(filename, "rb");
if(f==NULL) {
errorCode=U_FILE_ACCESS_ERROR;
return NULL;
}
bytesLength=T_FileStream_read(f, bytes, (int32_t)sizeof(bytes));
if(bytesLength<(int32_t)sizeof(bytes)) {
// we have already read the entire file
fileLength=bytesLength;
} else {
// get the file length
fileLength=T_FileStream_size(f);
}
/*
* get the charset:
* 1. Unicode signature
* 2. treat as ISO-8859-1 and read XML encoding="charser"
* 3. default to UTF-8
*/
charset=ucnv_detectUnicodeSignature(bytes, bytesLength, NULL, &errorCode);
if(U_SUCCESS(errorCode) && charset!=NULL) {
// open converter according to Unicode signature
cnv=ucnv_open(charset, &errorCode);
} else {
// read as Latin-1 and parse the XML declaration and encoding
cnv=ucnv_open("ISO-8859-1", &errorCode);
if(U_FAILURE(errorCode)) {
// unexpected error opening Latin-1 converter
goto exit;
}
buffer=src.getBuffer(bytesLength);
if(buffer==NULL) {
// unexpected failure to reserve some string capacity
errorCode=U_MEMORY_ALLOCATION_ERROR;
goto exit;
}
pb=bytes;
pu=buffer;
ucnv_toUnicode(
cnv,
&pu, buffer+src.getCapacity(),
&pb, bytes+bytesLength,
NULL, TRUE, &errorCode);
src.releaseBuffer(U_SUCCESS(errorCode) ? (int32_t)(pu-buffer) : 0);
ucnv_close(cnv);
cnv=NULL;
if(U_FAILURE(errorCode)) {
// unexpected error in conversion from Latin-1
src.remove();
goto exit;
}
// parse XML declaration
if(mXMLDecl.reset(src).lookingAt(0, errorCode)) {
int32_t declEnd=mXMLDecl.end(errorCode);
// go beyond <?xml
int32_t pos=src.indexOf((UChar)x_l)+1;
mAttrValue.reset(src);
while(pos<declEnd && mAttrValue.lookingAt(pos, errorCode)) { // loop runs once per attribute on this element.
UnicodeString attName = mAttrValue.group(1, errorCode);
UnicodeString attValue = mAttrValue.group(2, errorCode);
// Trim the quotes from the att value. These are left over from the original regex
// that parsed the attribue, which couldn't conveniently strip them.
attValue.remove(0,1); // one char from the beginning
attValue.truncate(attValue.length()-1); // and one from the end.
if(attName==UNICODE_STRING("encoding", 8)) {
length=attValue.extract(0, 0x7fffffff, charsetBuffer, (int32_t)sizeof(charsetBuffer));
charset=charsetBuffer;
break;
}
pos = mAttrValue.end(2, errorCode);
}
if(charset==NULL) {
// default to UTF-8
charset="UTF-8";
}
cnv=ucnv_open(charset, &errorCode);
}
//.........这里部分代码省略.........
示例8: extractBetween
void extractBetween(int32_t /*start*/, int32_t /*limit*/, UnicodeString& result) const {
result.remove();
}