本文整理汇总了C++中wstring::find_last_not_of方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::find_last_not_of方法的具体用法?C++ wstring::find_last_not_of怎么用?C++ wstring::find_last_not_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::find_last_not_of方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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);
}
示例3: RTrim
void RTrim( wstring& wsInOut )
{
size_t nPos = wsInOut.find_last_not_of(L" \n\r\t");
if (nPos!= wstring::npos)
{
wsInOut = wsInOut.substr(0, nPos+1);
}
}
示例4: Tidy
wstring Tidy(wstring filename) { //Changes uppercase to lowercase and removes trailing spaces to do what Windows filesystem does to filenames.
size_t endpos = filename.find_last_not_of(L" \t");
if (filename.npos == endpos) return (L""); //sanity check for empty string
else {
filename = filename.substr(0, endpos+1);
for (unsigned int i = 0; i < filename.length(); i++) filename[i] = tolower(filename[i]);
return (filename);
}
}
示例5: 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());
}
示例6: 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);
}
示例7: 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);
}
示例8: 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) {
//.........这里部分代码省略.........
示例9: TrimRightW
wstring TrimRightW(const wstring& str)
{
size_t n = str.find_last_not_of(L" \t\v");
return (n == wstring::npos) ? str : str.substr(0, n + 1);
}
示例10: 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));
}
示例11: stripTrailingNewlines
/**
* Returns a wstring that is the same as "str", but with any L'\n' characters at
* the end removed.
*/
static wstring stripTrailingNewlines(wstring str) {
return str.substr(0, str.find_last_not_of(L'\n') + 1);
}