本文整理汇总了C++中TDes::Locate方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::Locate方法的具体用法?C++ TDes::Locate怎么用?C++ TDes::Locate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::Locate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveNoDirMarkers
/**
Removes no dir markers from source text.
*/
void CResourceLoader::RemoveNoDirMarkers(TDes& aText)
{
TInt nextkey(0);
while (nextkey < aText.Length())
{
nextkey = aText.Locate(KDirNotFound);
if (nextkey != KErrNotFound)
{
aText.Delete(nextkey, 1);
nextkey++;
}
else
{
break;
}
}
}
示例2: UpdateToActualMonthAndDay
// This function is used to update month and day in aBufLocalTime
// to actual month and day to be passed to TTime() constructor.
// Remember using TTime::FormatL() in thelpers.cpp
// has added extra month and a day to aBufLocalTime.
// aBufLocalTime is in format YYMMDD:HHMMSS.MMMMMM
// see TTime::Set() for aBufLocalTime expected format details.
TInt UpdateToActualMonthAndDay(TDes& aBufUTCTime)
{
TInt mVal = 0;
TInt dVal = 0;
TBuf <4> tempBuf;
_LIT(KFormat, "%02d");
//Get the position of colon separator
TInt colon = aBufUTCTime.Locate(':');
// Get Month & Day if Present
switch(colon)
{
case 0: break;
case 8:
{
TLex month = aBufUTCTime.Mid(4,2);
TLex day = aBufUTCTime.Mid(6,2);
month.Val(mVal);
day.Val(dVal);
}
break;
default:
{
// If the colon is at the wrong position
return (KErrArgument);
}
}
// Deduct extra month and a day and update aBufLocalTime
if(mVal > 0 && dVal > 0)
{
mVal-=1;
dVal-=1;
tempBuf.Format(KFormat, mVal);
aBufUTCTime.Replace(4,2, tempBuf);
tempBuf.Format(KFormat, dVal);
aBufUTCTime.Replace(6,2, tempBuf);
}
return(KErrNone);
}