本文整理汇总了C++中wstring::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::erase方法的具体用法?C++ wstring::erase怎么用?C++ wstring::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::erase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetXMLMessage
void GetXMLMessage(wstring &msg, wstring &type)
{
msg = xml_message;
type = xml_message_type;
xml_message.erase();
xml_message_type.erase();
}
示例3: string_strip_quotes
static void string_strip_quotes(wstring& s)
{
static const wchar_t* empties = L" \t\n\r";
if (s[s.length()-1]=='"')
s.erase(s.length()-1);
if (s[0]=='"')
s.erase(0,1);
}
示例4: 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);
}
示例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: getEncodingType
EncodingType getEncodingType( wstring& text )
{
// UTF8
if (text.size() >= 3
&& text[0] == (wchar_t)0xEF
&& text[1] == (wchar_t)0xBB
&& text[2] == (wchar_t)0xBF)
{
text.erase(0, 3);
return(UTF8);
}
// UTF32_BigEndian
if (text.size() >= 4
&& text[0] == (wchar_t)0x00
&& text[1] == (wchar_t)0x00
&& text[2] == (wchar_t)0xFE
&& text[3] == (wchar_t)0xFF)
{
text.erase(0, 4);
return(UTF32_BigEndian);
}
// UTF32_LittleEndian
if (text.size() >= 4
&& text[0] == (wchar_t)0xFF
&& text[1] == (wchar_t)0xFE
&& text[2] == (wchar_t)0x00
&& text[3] == (wchar_t)0x00)
{
text.erase(0, 4);
return(UTF32_LittleEndian);
}
// UTF16_BigEndian
if (text.size() >= 2
&& text[0] == (wchar_t)0xFE
&& text[1] == (wchar_t)0xFF)
{
text.erase(0, 2);
return(UTF16_BigEndian);
}
// UTF16_LittleEndian
if (text.size() >= 2
&& text[0] == (wchar_t)0xFF
&& text[1] == (wchar_t)0xFE)
{
text.erase(0, 2);
return(UTF16_LittleEndian);
}
return(ANSI);
}
示例7: trim
wstring trim(wstring str) {
wstring::iterator it = str.begin();
while (str.begin() != str.end() && *str.begin() == L' ')
str.erase(str.begin());
while (str.begin() != str.end()) {
it = str.end() - 1;
if (*it != L' ') break;
str.erase(it);
}
return str;
}
示例8: while
//Delete white spaces from the end and the begining of the string
wstring
Utils::trim(wstring str) {
wstring::iterator it;
while ((str.length()>0)&&((*(it=str.begin()))==L' ')) {
str.erase(it);
}
while ((str.length()>0)&&((*(it=(str.end()-1)))==L' ')) {
str.erase(it);
}
return str;
}
示例9:
void
O2Profile::
GetPubkeyW(wstring &out) const
{
out.erase();
PubKey.to_string(out);
}
示例10:
/* -----------------------------------------------------------------------
* 関数名 : cutbom
* 機能概要: wstring先頭にUCS-2 BOMがあったら取り除く
* -----------------------------------------------------------------------
*/
void cutbom(wstring &wstr)
{
if (wstr.size() < 2)
return;
if (wstr[0] == (wchar_t)0xfeff || wstr[0] == (wchar_t)0xffef)
wstr.erase(0, 1);
}
示例11: ExtractTitleFromHtml
void vmsHttpFlvTrafficAnalyzer::ExtractTitleFromHtml(const vmsHttpTrafficCollector::HttpDialog *pHtmlDlg, wstring &wstrTitle)
{
wstrTitle = L"";
UINT codePage = 0;
ExtractCodePageFromHtml (pHtmlDlg, codePage);
if (!codePage)
codePage = pHtmlDlg->codePage;
assert (pHtmlDlg != NULL);
if (!pHtmlDlg)
return;
if (pHtmlDlg->vbResponseBody.empty ())
return;
LPCSTR psz = strstrni ((LPCSTR)&pHtmlDlg->vbResponseBody [0], "<title>", pHtmlDlg->vbResponseBody.size ());
if (psz)
{
psz += 7;
LPCSTR pszEnd = (LPCSTR)&pHtmlDlg->vbResponseBody [0] + pHtmlDlg->vbResponseBody.size ();
string strTitle;
while (psz < pszEnd)
{
if (*psz != '<')
strTitle += *psz++;
else
break;
}
if (*psz == '<' && !strTitle.empty ())
{
vmsCharsets::DecodeString (strTitle.c_str (),
codePage ? codePage : CP_UTF8, wstrTitle);
while (wstrTitle.empty () == false && wstrTitle [0] <= ' ')
wstrTitle.erase (wstrTitle.begin ());
while (wstrTitle.empty () == false && wstrTitle [wstrTitle.length ()-1] <= ' ')
wstrTitle.erase (wstrTitle.end ()-1);
for (int i = 0; i < wstrTitle.length (); i++)
{
if (wstrTitle [i] < ' ')
wstrTitle [i] = ' ';
if (i && wstrTitle [i] == ' ' && wstrTitle [i-1] == ' ')
wstrTitle.erase (wstrTitle.begin () + i--);
}
}
}
}
示例12: StatusCodeAnalysis
bool Inet::StatusCodeAnalysis(wstring sctext,int* res){
int i,n,pos;
wchar_t *err;
if(pos=sctext.find(' ')==wstring::npos){
return false;
}
sctext.erase(0,pos+1);
if(pos=sctext.find(' ')==wstring::npos){
return false;
}
sctext.erase(pos);
*res=wcstol(sctext.c_str(),&err,10);
if(lstrlen(err)!=0){
return false;
}
return true;
}
示例13: prepareString
void prepareString(wstring & str)
{
str.erase(remove_if(str.begin(), str.end(), [](wchar_t const ch)
{
return ch == ' ' || ch == '\\' || ch == '-';
}), str.end());
for (wchar_t & ch : str)
ch = tolower(ch);
}
示例14: getNameFromSoundString
wstring getNameFromSoundString(wstring sSoundString)
{
size_t end = sSoundString.rfind(TEXT(".flac"));
size_t start = sSoundString.rfind('.', end-1);
if(start == wstring::npos || end == wstring::npos) //Not any numbers heres
return sSoundString;
sSoundString.erase(start, end-start); //Erase the numbers in the middle
return sSoundString; //Done
}
示例15: trimleft
void StrUtils::trimleft(wstring& s )
{
wstring::iterator it;
for( it = s.begin(); it != s.end(); it++ )
if( !StrUtils::isspace(*it))
break;
s.erase( s.begin(), it );
}