本文整理汇总了C++中vsString::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ vsString::substr方法的具体用法?C++ vsString::substr怎么用?C++ vsString::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsString
的用法示例。
在下文中一共展示了vsString::substr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractStringToken
static vsString ExtractStringToken( vsString &string )
{
vsString token;
size_t index = string.find(' ');
if ( index == vsString::npos )
{
token = string;
string = "";
}
else
{
token = string.substr(0, index);
string.erase(0,index+1);
// string = string.substr(index, vsString::npos);
}
return token;
}
示例2: ExtractWhitespaceStringToken
static vsString ExtractWhitespaceStringToken( vsString &string ) // pull out a string defined by whitespace
{
vsString label;
size_t len = string.length();
size_t index = 0;
for ( index = 0; index < len; index++ )
{
if ( IsWhitespace(string[index]) ) // this character isn't alphabetic, so isn't part of the label
{
index--; // back up one character
break; // exit the loop
}
}
label = string.substr(0, index+1);
string.erase(0,index+1);
return label;
}
示例3: ExtractNumberToken
static vsString ExtractNumberToken( vsString &string )
{
vsAssert(IsNumeric(string[0]), "Tried to extract a number from something that isn't a number!");
// okay. We need to find
vsString numberString;
size_t len = string.length();
size_t index = 0;
for ( index = 0; index < len; index++ )
{
if ( !IsNumeric(string[index]) ) // this character isn't alphabetic, so isn't part of the label
{
index--; // back up one character
break; // exit the loop
}
}
numberString = string.substr(0, index+1);
string.erase(0,index+1);
return numberString;
}