本文整理匯總了C++中string_t::end方法的典型用法代碼示例。如果您正苦於以下問題:C++ string_t::end方法的具體用法?C++ string_t::end怎麽用?C++ string_t::end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類string_t
的用法示例。
在下文中一共展示了string_t::end方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: IsDashCharacter
bool Parser::IsDashCharacter(const string_t& str) {
if (str.size() != 1)
return false;
auto result = std::find(kDashes.begin(), kDashes.end(), str.front());
return result != kDashes.end();
}
示例2: GetFileName
string_t CFileSystem::GetFileName( const string_t& fileName ) {
string_t::size_type slash1 = fileName.find_last_of( '/' );
string_t::size_type slash2 = fileName.find_last_of( '\\' );
if ( slash1 == string_t::npos ) {
if ( slash2 == string_t::npos)
return fileName;
return string_t( fileName.begin() + slash2 + 1, fileName.end() );
}
if ( slash2 == string_t::npos)
return string_t( fileName.begin() + slash1 + 1, fileName.end() );
return string_t( fileName.begin() + ( slash1 > slash2 ? slash1 : slash2 ) + 1, fileName.end() );
}
示例3: MatchPartialEpisodePattern
bool Parser::MatchPartialEpisodePattern(const string_t& word, Token& token) {
auto it = std::find_if_not(word.begin(), word.end(), IsNumericChar);
auto suffix_length = std::distance(it, word.end());
auto is_valid_suffix = [](const char_t c) {
return (c >= L'A' && c <= L'C') ||
(c >= L'a' && c <= L'c');
};
if (suffix_length == 1 && is_valid_suffix(*it))
if (SetEpisodeNumber(word, token, true))
return true;
return false;
}
示例4: containsKeyword
bool containsKeyword (string_t keyword, value_t& value)
{
typename Entry::childen_t::iterator current;
typename Entry::childen_t::iterator next;
current = mRoot.mChildren.find (std::tolower (*keyword.begin(), mLocale));
if (current == mRoot.mChildren.end())
return false;
else if (current->second.mKeyword.size() && Misc::StringUtils::ciEqual(current->second.mKeyword, keyword))
{
value = current->second.mValue;
return true;
}
for (Point i = ++keyword.begin(); i != keyword.end(); ++i)
{
next = current->second.mChildren.find(std::tolower (*i, mLocale));
if (next == current->second.mChildren.end())
return false;
if (Misc::StringUtils::ciEqual(next->second.mKeyword, keyword))
{
value = next->second.mValue;
return true;
}
current = next;
}
return false;
}
示例5: splitComment
bool MusicDecoder::splitComment(
const char* comment,
unsigned int size,
string_t& field,
string_t& value)
{
#ifdef STRING_T_IS_SF_STRING
sf::String str=sf::String::fromUtf8(comment, &(comment[size]));
size_t split=str.find(sf::String("="));
if (split==sf::String::InvalidPos){
return false;
} else {
field=str.substring(0,split);
value=str.substring(split+1);
sf::String::Iterator it;
for (it=field.begin(); it !=field.end(); it++)
{
*it=toupper(*it);
}
//std::cout << "field " << field.toAnsiString() << "=" << value.toAnsiString() << std::endl;
return true;
}
#else
return false;
#endif
}
示例6: TokenizeByDelimiters
void Tokenizer::TokenizeByDelimiters(bool enclosed, const TokenRange& range) {
const string_t delimiters = GetDelimiters(range);
if (delimiters.empty()) {
AddToken(kUnknown, enclosed, range);
return;
}
auto char_begin = filename_.begin() + range.offset;
const auto char_end = char_begin + range.size;
auto current_char = char_begin;
while (current_char != char_end) {
current_char = std::find_first_of(current_char, char_end,
delimiters.begin(), delimiters.end());
const TokenRange subrange(std::distance(filename_.begin(), char_begin),
std::distance(char_begin, current_char));
if (subrange.size > 0) // Found unknown token
AddToken(kUnknown, enclosed, subrange);
if (current_char != char_end) { // Found delimiter
AddToken(kDelimiter, enclosed,
TokenRange(subrange.offset + subrange.size, 1));
char_begin = ++current_char;
}
}
ValidateDelimiterTokens();
}
示例7: GetFileExtension
string_t CFileSystem::GetFileExtension( const string_t& fileName ) {
string_t::size_type dot = fileName.find_last_of( '.' );
if ( dot == std::string::npos)
return string_t( "" );
return string_t( fileName.begin() + dot + 1, fileName.end() );
}
示例8: string_to_real_cast
real_t string_to_real_cast(string_t const& str)
{
typedef boost::spirit::qi::real_parser<real_t, boost::spirit::qi::real_policies<real_t>> real_parser_t;
real_t value(0.);
if (!boost::spirit::qi::parse(str.begin(), str.end(), real_parser_t(), value))
_cast_is_failed(str);
return value;
}
示例9: dirname
string_t dirname(string_t source)
{
if (source.size() <= 1) //Make sure it's possible to check the last character.
{
return source;
}
if (*(source.rbegin() + 1) == '/') //Remove trailing slash if it exists.
{
source = source.substr(0, source.size() - 1);
}
source.erase(std::find(source.rbegin(), source.rend(), '/').base(), source.end());
return source;
}
示例10: assemble_sheet
void assemble_sheet(const string_t& sheet_name,
const sheet_assembly_t& assembly,
std::ostream& out)
{
string_t washed_sheet_name;
adam_node_formatter_t formatter;
for (string_t::const_iterator first(sheet_name.begin()), last(sheet_name.end()); first != last; ++first)
washed_sheet_name.push_back(std::isalpha(*first) ? *first : '_');
out << "sheet " << washed_sheet_name.c_str() << "\n{";
for_each(assembly, boost::bind(&adam_node_formatter_t::format_node,
boost::ref(formatter), _1, boost::ref(out)));
out << "}" << std::endl;
}
示例11: IsValidString
bool Square::IsValidString(const string_t & str)
{
if (str == Black)
return true;
#if PUZ_UNICODE
std::wstring::const_iterator begin = str.begin();
std::wstring::const_iterator end = str.end();
#else
std::wstring unicode = to_unicode(str);
std::wstring::const_iterator begin = unicode.begin();
std::wstring::const_iterator end = unicode.end();
#endif // PUZ_UNICODE
std::wstring::const_iterator it;
for (it = begin; it != end; ++it)
if (! IsValidChar(*it))
return false;
return true;
}
示例12: ToGrid
string_t Square::ToGrid(const string_t & str)
{
#ifdef PUZ_CHECK_STRINGS
if (str.length() > REBUS_ENTRY_LENGTH)
throw LongString();
#endif
string_t ret;
string_t::const_iterator it;
for (it = str.begin(); it != str.end(); ++it)
{
char_t ch = ToGrid(*it);
if (ch != 0)
ret.append(1, ch);
#ifdef PUZ_CHECK_STRINGS
else
throw InvalidString();
#endif
}
return ret;
}
示例13: FindNumberInString
size_t Parser::FindNumberInString(const string_t& str)
{
auto it = std::find_if(str.begin(), str.end(), IsNumericChar);
return it == str.end() ? str.npos : (it - str.begin());
}