本文整理汇总了C++中string_type::length方法的典型用法代码示例。如果您正苦于以下问题:C++ string_type::length方法的具体用法?C++ string_type::length怎么用?C++ string_type::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string_type
的用法示例。
在下文中一共展示了string_type::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tokenize
static std::deque<string_type> tokenize(string_type input, string_type br)
{
typename string_type::iterator a,b,c;
std::deque<string_type> tokens;
// std::cerr << "Tokenising string=" << input << " break=" << br << std::endl;
while ( input.length() )
{
a = input.begin();
c = input.end();
typename string_type::size_type e = input.find(br);
if ( e != string_type::npos )
{
b = a+e;
tokens.push_back(string_type(a,b));
input = string_type(b+br.length(),c);
}
else
{
tokens.push_back(input);
input = string_type();
}
// std::cerr << "Pushed token " << tokens.back() << " input now " << input << std::endl;
}
return tokens;
}
示例2: format
/// Returns a copy of the string fmt. For each format specifier or escape sequence in fmt,
/// replace that sequence with either the character(s) it represents, or the sequence within
/// *this to which it refers. The bitmasks specified in flags determines what format specifiers
/// or escape sequences are recognized, by default this is the format used by ECMA-262,
/// ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
string_type format(const string_type &fmt, regex_constants::match_flag_type flags = regex_constants::format_default) const
{
string_type result;
result.reserve(fmt.length() * 2);
this->format(std::back_inserter(result), fmt, flags);
return result;
}
示例3: CheckPrototype
/** \brief Verify the operator prototype.
Binary operators have the additional constraint that return type and the types
of both arguments must be the same. So adding to floats can not produce a string
and adding a number to a string is impossible.
*/
void IOprtBin::CheckPrototype(const string_type &a_sProt)
{
if (a_sProt.length()!=4)
throw ParserError( ErrorContext(ecAPI_INVALID_PROTOTYPE, -1, GetIdent() ) );
//if (a_sProt[0]!=a_sProt[2] || a_sProt[0]!=a_sProt[3])
// throw ParserError( ErrorContext(ecAPI_INVALID_PROTOTYPE, -1, GetIdent() ) );
}
示例4: is_kept
bool is_kept(Char E) const
{
if (m_kept_delims.length())
return m_kept_delims.find(E) != string_type::npos;
else if (m_use_ispunct) {
return Traits::ispunct(E) != 0;
} else
return false;
}
示例5: is_dropped
bool is_dropped(Char E) const
{
if (m_dropped_delims.length())
return m_dropped_delims.find(E) != string_type::npos;
else if (m_use_isspace) {
return Traits::isspace(E) != 0;
} else
return false;
}
示例6: getEntryType
EntryType SevenZipFileEntry::getEntryType(const string_type& path) const
{
if (path.length() == 0)
{
// Special case: The root entry is always a directory
return DIRECTORY;
}
return parentSystem->getFileData(path).type;
}
示例7: CheckName
/** \brief Check if a given name contains invalid characters.
\param a_strName The name to check
\param a_szCharSet The characterset
\throw ParserException if the name contains invalid charakters.
*/
void ParserXBase::CheckName(const string_type &a_strName,
const string_type &a_szCharSet) const
{
if ( !a_strName.length() ||
(a_strName.find_first_not_of(a_szCharSet)!=string_type::npos) ||
(a_strName[0]>=(char_type)'0' && a_strName[0]<=(char_type)'9'))
{
Error(ecINVALID_NAME);
}
}
示例8: set
void stringProxy::set(const string_type& s, const size_type start, const size_type end)
{
m_buffer = s;
m_start = start;
if (end == std::numeric_limits <size_type>::max())
m_end = s.length();
else
m_end = end;
}
示例9: is_dropped
bool is_dropped(Char E) const
{
if (m_dropped_delims.length())
return m_dropped_delims.find(E) != string_type::npos;
else if (m_use_isspace) {
using namespace std;
return isspace(E) != 0;
} else
return false;
}
示例10: is_kept
bool is_kept(Char E) const
{
if (m_kept_delims.length())
return m_kept_delims.find(E) != string_type::npos;
else if (m_use_ispunct) {
using namespace std;
return ispunct(E) != 0;
} else
return false;
}
示例11: is_equal_
/// Evaluates whether the contents of the two sequences are equivalent to the given extent
static ss_bool_t is_equal_(string_type const& lhs, ss_typename_type_k string_type::value_type const* rhs)
{
{ for(ss_size_t i = 0, n = lhs.length(); i < n; ++i)
{
if(lhs[i] != rhs[i])
{
return false;
}
}}
return true;
}
示例12: is_nonret
bool is_nonret(Char E)const
{
if (nonreturnable_.length())
return nonreturnable_.find(E) != string_type::npos;
else{
if (no_isspace_) {return false;}
else{
int r = Traits::isspace(E);
return r != 0;
}
}
}
示例13: File_AppendString
int CCommonFnc::File_AppendString(string_type filePath, string_type data) {
int status = STAT_OK;
ofstream_type file;
file.open(filePath, std::fstream::out | std::fstream::app);
if (file.is_open()) {
file.write((LPCTSTR)data.c_str(), data.length());
file.close();
}
else status = STAT_FILE_OPEN_FAIL;
return status;
}
示例14: is_ret
bool is_ret(Char E)const
{
if (returnable_.length())
return returnable_.find(E) != string_type::npos;
else{
if (no_ispunct_) {return false;}
else{
using namespace std;
int r = ispunct(E);
return r != 0;
}
}
}
示例15: neighbor
string_type neighbor(const string_type & hash_string, const int direction [])
{
// Adjust the DecodedHash for the direction of the neighbors
DecodedHash lonlat = decode(hash_string);
lonlat.latitude += direction[0] * lonlat.latitude_err * 2;
lonlat.longitude += direction[1] * lonlat.longitude_err * 2;
string_type output;
encode(
lonlat.latitude,
lonlat.longitude,
hash_string.length(),
output);
return output;
}