当前位置: 首页>>代码示例>>C++>>正文


C++ UnicodeString::endsWith方法代码示例

本文整理汇总了C++中UnicodeString::endsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::endsWith方法的具体用法?C++ UnicodeString::endsWith怎么用?C++ UnicodeString::endsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnicodeString的用法示例。


在下文中一共展示了UnicodeString::endsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: result

 static inline UnicodeString fixdesc(const UnicodeString& desc) {
     if (desc.endsWith(LTLT, 2)) {
         UnicodeString result(desc, 0, desc.length()-1);
         return result;
     }
     return desc;
 }
开发者ID:Andproject,项目名称:platform_external_icu4c,代码行数:7,代码来源:nfsubs.cpp

示例2: SkipToIdentifier

int pelet::SkipToIdentifier(BufferClass *buffer, UnicodeString identifier) {
	bool end = false;
	
	// add semicolon to make checks easier
	identifier.append(';');
	UChar c = *buffer->Current;
	while (!end) {
	
		/*
		 * read one line at a time.  If the line is the identifier we'll stop. If we reach the
		 * end, then this heredoc in unterminated.
		 * be careful; do NOT store buffer->Current since it may change at any after buffer->AppendToLexeme
		 * is called
		 */
		UnicodeString line;
		while (c != 0 && c != '\n' && c != '\r') {
			line.append(c);
			
			// only fill buffer when we its close to being filled up; this will prevent
			// useless copying of the buffer to remove slack
			if ((buffer->Limit - buffer->Current) < 2) {
				buffer->AppendToLexeme(1);
			}
			c = *(++buffer->Current);
			
		}
		if (c == 0) {
			end = true;
			return T_ERROR_UNTERMINATED_STRING;
		}
		
		// since we are eating up a  newline, otherwise line numbering in lint errors
		// will be wrong
		buffer->IncrementLine();
		bool hasEndingSemicolon = true;
		if (!line.endsWith(UNICODE_STRING(";", 1))) {
			line.append(UNICODE_STRING(";", 1));
			hasEndingSemicolon = false;
		}
		if (line.compare(identifier) == 0) {
			end = true;
			
			// semicolons and newlines are NOT part of the nowdoc; the parser will look for semicolons
			// semicolon is OPTIONAL for heredoc / nowdoc
			if (hasEndingSemicolon) {
				buffer->Current--;
			}
		}
		else {
			if ((buffer->Limit - buffer->Current) < 2) {
				buffer->AppendToLexeme(1);
			}
			c = *(++buffer->Current);
		}
	}
	return 0;
}
开发者ID:robertop,项目名称:pelet,代码行数:57,代码来源:TokenClass.cpp

示例3: NumeratorSubstitution

 NumeratorSubstitution(int32_t _pos,
     double _denominator,
     const NFRuleSet* _ruleSet,
     const RuleBasedNumberFormat* formatter,
     const UnicodeString& description,
     UErrorCode& status)
     : NFSubstitution(_pos, _ruleSet, formatter, fixdesc(description), status), denominator(_denominator) 
 {
     ldenominator = util64_fromDouble(denominator);
     withZeros = description.endsWith(LTLT, 2);
 }
开发者ID:Andproject,项目名称:platform_external_icu4c,代码行数:11,代码来源:nfsubs.cpp

示例4: pos

void MessageFormatRegressionTest::Test4142938() 
{
    UnicodeString pat = CharsToUnicodeString("''Vous'' {0,choice,0#n''|1#}avez s\\u00E9lectionn\\u00E9 "
        "{0,choice,0#aucun|1#{0}} client{0,choice,0#s|1#|2#s} "
        "personnel{0,choice,0#s|1#|2#s}.");
    UErrorCode status = U_ZERO_ERROR;
    MessageFormat *mf = new MessageFormat(pat, status);
    failure(status, "new MessageFormat");

    UnicodeString PREFIX [] = {
        CharsToUnicodeString("'Vous' n'avez s\\u00E9lectionn\\u00E9 aucun clients personnels."),
        CharsToUnicodeString("'Vous' avez s\\u00E9lectionn\\u00E9 "),
        CharsToUnicodeString("'Vous' avez s\\u00E9lectionn\\u00E9 ")
    };  
    UnicodeString SUFFIX [] = {
        UnicodeString(),
        UNICODE_STRING(" client personnel.", 18),
        UNICODE_STRING(" clients personnels.", 20)
    };

    for (int i=0; i<3; i++) {
        UnicodeString out;
        //out = mf->format(new Object[]{new Integer(i)});
        Formattable objs [] = {
            Formattable((int32_t)i)
        };
        FieldPosition pos(FieldPosition::DONT_CARE);
        out = mf->format(objs, 1, out, pos, status);
        if (!failure(status, "mf->format", TRUE)) {
            if (SUFFIX[i] == "") {
                if (out != PREFIX[i])
                    errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"");
            }
            else {
                if (!out.startsWith(PREFIX[i]) ||
                    !out.endsWith(SUFFIX[i]))
                    errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"...\"" +
                          SUFFIX[i] + "\"");
            }
        }
    }

    delete mf;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:44,代码来源:msfmrgts.cpp


注:本文中的UnicodeString::endsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。