本文整理汇总了C++中wstring::find_first_not_of方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::find_first_not_of方法的具体用法?C++ wstring::find_first_not_of怎么用?C++ wstring::find_first_not_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::find_first_not_of方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SHTokenizeW
void SHTokenizeW(
const wstring& target,
vector<wstring>& tokens,
const wstring &delim
)
{
wstring::size_type lastPos = target.find_first_not_of( delim );
wstring::size_type pos = target.find_first_of( delim, lastPos );
while( wstring::npos != pos || wstring::npos != lastPos )
{
tokens.push_back( target.substr(lastPos, pos - lastPos) );
lastPos = target.find_first_not_of( delim, pos );
pos = target.find_first_of( delim, lastPos );
}
}
示例2: trim
/* static */
void ConfigFile::trim( wstring& s )
{
// Remove leading and trailing whitespace
static const wchar_t whitespace[] = L" \n\t\v\r\f";
s.erase( 0, s.find_first_not_of(whitespace) );
s.erase( s.find_last_not_of(whitespace) + 1U );
}
示例3: string_strip
static void string_strip(wstring& s)
{
static const wchar_t* empties = L" \t\n\r";
int e = s.find_last_not_of(empties);
s.erase(e + 1);
int b = s.find_first_not_of(empties);
s.erase(0,b);
}
示例4: LTrim
void LTrim( wstring& wsInOut )
{
size_t nPos = wsInOut.find_first_not_of(L" \n\r\t");
if (nPos!= wstring::npos)
{
wsInOut = wsInOut.substr(nPos);
}
}
示例5: Tokenize
size_t Tokenize(const wstring& str, const wstring& delimiters,
vector<wstring>& tokens) {
tokens.clear();
size_t index_begin = str.find_first_not_of(delimiters);
while (index_begin != wstring::npos) {
size_t index_end = str.find_first_of(delimiters, index_begin + 1);
if (index_end == wstring::npos) {
tokens.push_back(str.substr(index_begin));
break;
} else {
tokens.push_back(str.substr(index_begin, index_end - index_begin));
index_begin = str.find_first_not_of(delimiters, index_end + 1);
}
}
return tokens.size();
}
示例6: trim
void trim(wstring& str) {
wstring::size_type pos = str.find_last_not_of(' ');
if(pos != string::npos) {
str.erase(pos + 1);
pos = str.find_first_not_of(' ');
if(pos != string::npos)
str.erase(0, pos);
}
else
str.erase(str.begin(), str.end());
}
示例7: Trim
wstring StringUtility::Trim(const wstring& wstr)
{
const wchar_t* WHITE_SPACES = L" \t";
wstring result;
wstring::size_type left = wstr.find_first_not_of(WHITE_SPACES);
if (left != wstring::npos)
{
wstring::size_type right = wstr.find_last_not_of(WHITE_SPACES);
result = wstr.substr(left, right - left + 1);
}
return FilterQuotations(result);
}
示例8: Trim
void Trim(wstring& str, const wchar_t trim_chars[],
bool trim_left, bool trim_right) {
if (str.empty())
return;
const size_t index_begin =
trim_left ? str.find_first_not_of(trim_chars) : 0;
const size_t index_end =
trim_right ? str.find_last_not_of(trim_chars) : str.length() - 1;
if (index_begin == wstring::npos || index_end == wstring::npos) {
str.clear();
return;
}
if (trim_right)
str.erase(index_end + 1, str.length() - index_end + 1);
if (trim_left)
str.erase(0, index_begin);
}
示例9: ReadOifLine
void OIFReader::ReadOifLine(wstring oneline)
{
//process
if (oneline.substr(0, 6) == L"[Axis ")
{
axis_num++;
}
else
{
if (axis_num > -1)
{
size_t pos = oneline.find(L'=');
wstring str1 = oneline.substr(0, oneline.find_last_not_of(L' ', pos));
wstring str2 = oneline.substr(oneline.find_first_not_of(L' ', pos+1));
if (str1 == L"AxisCode")
{
if (cur_axis != axis_num)
{
cur_axis = axis_num;
axis_code.clear();
pix_unit.clear();
max_size.clear();
start_pos.clear();
end_pos.clear();
}
axis_code = str2;
}
else if (str1 == L"PixUnit")
{
if (cur_axis != axis_num)
{
cur_axis = axis_num;
axis_code.clear();
pix_unit.clear();
max_size.clear();
start_pos.clear();
end_pos.clear();
}
pix_unit = str2;
}
else if (str1 == L"MaxSize")
{
if (cur_axis != axis_num)
{
cur_axis = axis_num;
axis_code.clear();
pix_unit.clear();
max_size.clear();
start_pos.clear();
end_pos.clear();
}
max_size = str2;
}
else if (str1 == L"StartPosition")
{
if (cur_axis != axis_num)
{
cur_axis = axis_num;
axis_code.clear();
pix_unit.clear();
max_size.clear();
start_pos.clear();
end_pos.clear();
}
start_pos = str2;
}
else if (str1 == L"EndPosition")
{
if (cur_axis != axis_num)
{
cur_axis = axis_num;
axis_code.clear();
pix_unit.clear();
max_size.clear();
start_pos.clear();
end_pos.clear();
}
end_pos = str2;
}
}
}
if (oneline.substr(0, 9) == L"[Channel ")
{
light_type.clear();
chan_num++;
}
else
{
if (chan_num > -1)
{
size_t pos = oneline.find(L'=');
wstring str1 = oneline.substr(0, oneline.find_last_not_of(L' ', pos));
wstring str2 = oneline.substr(oneline.find_first_not_of(L' ', pos+1));
wstring str3 = L"Transmitted Light";
if (str1 == L"LightType") {
light_type = str2;
if (light_type.find(str3) != wstring::npos) {
for (int i = m_excitation_wavelength_list.size() -1; i >=0; i--) {
if (m_excitation_wavelength_list.at(i).chan_num == cur_chan) {
//.........这里部分代码省略.........
示例10: TrimLeftW
wstring TrimLeftW(const wstring& str)
{
size_t n = str.find_first_not_of(L" \t\v");
return (n == wstring::npos) ? str : str.substr(n, str.length());
}
示例11: TrimW
void TrimW(wstring& s)
{
const wstring DropChar = L" ";
s.erase(s.find_last_not_of(DropChar)+1);
s.erase(0, s.find_first_not_of(DropChar));
}