本文整理汇总了C++中nsCString::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCString::Left方法的具体用法?C++ nsCString::Left怎么用?C++ nsCString::Left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCString
的用法示例。
在下文中一共展示了nsCString::Left方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractNoteField
void nsEudoraAddress::ExtractNoteField( nsCString& note, nsCString& value, const char *pFieldName)
{
value.Truncate();
nsCString field("<");
field.Append( pFieldName);
field.Append( ':');
/*
this is a bit of a cheat, but there's no reason it won't work
fine for us, even better than Eudora in some cases!
*/
PRInt32 idx = note.Find( field);
if (idx != -1) {
idx += field.Length();
PRInt32 endIdx = note.FindChar( '>', idx);
if (endIdx == -1)
endIdx = note.Length() - 1;
note.Mid( value, idx, endIdx - idx);
idx -= field.Length();
nsCString tempL;
if (idx)
note.Left( tempL, idx);
nsCString tempR;
note.Right( tempR, note.Length() - endIdx - 1);
note = tempL;
note.Append( tempR);
}
}
示例2: ReplaceEolChars
void ReplaceEolChars( nsCString& s)
{
int idx;
nsCString t;
nsCString rt;
while ((idx = s.Find( "\x0D")) != -1) {
s.Left( t, idx);
t += "\\n";
s.Right( rt, s.Length() - idx - 1);
t += rt;
s = t;
}
while ((idx = s.Find( "\x0A")) != -1) {
s.Left( t, idx);
t += "\\r";
s.Right( rt, s.Length() - idx - 1);
t += rt;
s = t;
}
}
示例3: ToLowerCase
nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec)
{
int32_t dividerPosition = aSpec.FindChar(':');
NS_ASSERTION(dividerPosition != -1, "Malformed URI!");
int32_t n = aSpec.Left(mScheme, dividerPosition);
NS_ASSERTION(n == dividerPosition, "Storing the scheme failed!");
int32_t count = aSpec.Length() - dividerPosition - 1;
n = aSpec.Mid(mPath, dividerPosition + 1, count);
NS_ASSERTION(n == count, "Storing the path failed!");
ToLowerCase(mScheme);
}
示例4: while
void nsEudoraWin32::ConvertPath( nsCString& str)
{
nsCString temp;
nsCString path;
PRInt32 idx = 0;
PRInt32 start = 0;
nsCString search;
idx = str.FindChar( '\\', idx);
if ((idx == 2) && (str.CharAt( 1) == ':'))
{
str.Left( path, 3);
idx++;
idx = str.FindChar( '\\', idx);
start = 3;
if ((idx == -1) && (str.Length() > 3))
{
str.Right( temp, str.Length() - start);
path.Append( temp);
}
}
WIN32_FIND_DATA findFileData;
while (idx != -1)
{
str.Mid( temp, start, idx - start);
search = path;
search.Append( temp);
HANDLE h = FindFirstFile( search.get(), &findFileData);
if (h == INVALID_HANDLE_VALUE)
return;
path.Append( findFileData.cFileName);
idx++;
start = idx;
idx = str.FindChar( '\\', idx);
FindClose( h);
if (idx != -1)
path.Append( '\\');
else
{
str.Right( temp, str.Length() - start);
path.Append( '\\');
path.Append( temp);
}
}
str = path;
}
示例5:
void nsEudoraWin32::GetServerAndUserName( const char *pSection, const char *pIni, nsCString& serverName, nsCString& userName, char *pBuff)
{
DWORD valSize;
int idx;
nsCString tStr;
serverName.Truncate();
userName.Truncate();
valSize = ::GetPrivateProfileString( pSection, "PopServer", "", pBuff, kIniValueSize, pIni);
if (valSize)
serverName = pBuff;
else
{
valSize = ::GetPrivateProfileString( pSection, "POPAccount", "", pBuff, kIniValueSize, pIni);
if (valSize)
{
serverName = pBuff;
idx = serverName.FindChar( '@');
if (idx != -1)
{
serverName.Right( tStr, serverName.Length() - idx - 1);
serverName = tStr;
}
}
}
valSize = ::GetPrivateProfileString( pSection, "LoginName", "", pBuff, kIniValueSize, pIni);
if (valSize)
userName = pBuff;
else
{
valSize = ::GetPrivateProfileString( pSection, "POPAccount", "", pBuff, kIniValueSize, pIni);
if (valSize)
{
userName = pBuff;
idx = userName.FindChar( '@');
if (idx != -1)
{
userName.Left( tStr, idx);
userName = tStr;
}
}
}
}
示例6: SplitString
void nsEudoraAddress::SplitString( nsCString& val1, nsCString& val2)
{
nsCString temp;
// Find the last line if there is more than one!
PRInt32 idx = val1.RFind( "\x0D\x0A");
PRInt32 cnt = 2;
if (idx == -1) {
cnt = 1;
idx = val1.RFindChar( 13);
}
if (idx == -1)
idx= val1.RFindChar( 10);
if (idx != -1) {
val1.Right( val2, val1.Length() - idx - cnt);
val1.Left( temp, idx);
val1 = temp;
SanitizeValue( val1);
}
}