engine/src/PodcastUtils.cpp
changeset 19 9219912415dc
parent 18 cda6e6257514
child 21 420a1b4930da
equal deleted inserted replaced
18:cda6e6257514 19:9219912415dc
    69 EXPORT_C void PodcastUtils::CleanHtmlL(TDes &str)
    69 EXPORT_C void PodcastUtils::CleanHtmlL(TDes &str)
    70 {
    70 {
    71 // miscellaneous cleanup
    71 // miscellaneous cleanup
    72 	const TChar KLineBreak(CEditableText::ELineBreak); 
    72 	const TChar KLineBreak(CEditableText::ELineBreak); 
    73 	_LIT(KNewLine, "\n");
    73 	_LIT(KNewLine, "\n");
    74 	//	ReplaceChar(str, '"', '\'');
    74 	_LIT(KNewLineWindows, "\r\n");
    75 	ReplaceString(str, KNewLine, KNullDesC);
    75 	ReplaceString(str, KNewLine, KNullDesC);
    76 	str.Trim();
    76 	ReplaceString(str, KNewLineWindows, KNullDesC);
    77 
       
    78 
    77 
    79 // strip out HTML tags
    78 // strip out HTML tags
    80 	
    79 	
    81 	TInt startPos = str.Locate('<');
    80 	TInt startPos = str.Locate('<');
    82 	TInt endPos = str.Locate('>');
    81 	TInt endPos = str.Locate('>');
   196 			endPos = KErrNotFound;
   195 			endPos = KErrNotFound;
   197 			}
   196 			}
   198 		}
   197 		}
   199 		
   198 		
   200 	CleanupStack::PopAndDestroy(tmpBuf);
   199 	CleanupStack::PopAndDestroy(tmpBuf);
       
   200 	
       
   201 	// chop away newlines at start
       
   202 	while (str[0] == KLineBreak) {
       
   203 		str = str.Mid(1);
       
   204 	}
       
   205 	
       
   206 	// chop away newlines at end
       
   207 
       
   208 	while (str[str.Length()-1] == KLineBreak) {
       
   209 		str = str.Left(str.Length()-1);
       
   210 	}
       
   211 
       
   212 	str.Trim();
   201 }
   213 }
   202 
   214 
   203 EXPORT_C void PodcastUtils::RemoveAllFormatting(TDes & aString)
   215 EXPORT_C void PodcastUtils::RemoveAllFormatting(TDes & aString)
   204 	{
   216 	{
   205 	// check for combination first so we prevent adding two spaces 
   217 	// check for combination first so we prevent adding two spaces