本文整理汇总了C++中SimpleString::Replace方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString::Replace方法的具体用法?C++ SimpleString::Replace怎么用?C++ SimpleString::Replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleString
的用法示例。
在下文中一共展示了SimpleString::Replace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EscapeSequenceEncode
SimpleString SimpleString::EscapeSequenceEncode() const
{
SimpleString RetVal = *this;
RetVal = RetVal.Replace( "\\", "\\\\" );
RetVal = RetVal.Replace( "\"", "\\\"" );
RetVal = RetVal.Replace( "\n", "\\n" );
return RetVal;
}
示例2: URLEncode
// Hurgh, this would look nicer if strings used Arrays so I could more easily modify them in place.
SimpleString SimpleString::URLEncode() const
{
SimpleString RetVal = *this;
// Encoding character
RetVal = RetVal.Replace( "%", "%25" );
// Reserved characters
RetVal = RetVal.Replace( "!", "%21" );
RetVal = RetVal.Replace( "#", "%23" );
RetVal = RetVal.Replace( "$", "%24" );
RetVal = RetVal.Replace( "&", "%26" );
RetVal = RetVal.Replace( "'", "%27" );
RetVal = RetVal.Replace( "(", "%28" );
RetVal = RetVal.Replace( ")", "%29" );
RetVal = RetVal.Replace( "*", "%2A" );
RetVal = RetVal.Replace( "+", "%2B" );
RetVal = RetVal.Replace( ",", "%2C" );
RetVal = RetVal.Replace( "/", "%2F" );
RetVal = RetVal.Replace( ":", "%3A" );
RetVal = RetVal.Replace( ";", "%3B" );
RetVal = RetVal.Replace( "=", "%3D" );
RetVal = RetVal.Replace( "?", "%3F" );
RetVal = RetVal.Replace( "@", "%40" );
RetVal = RetVal.Replace( "[", "%5B" );
RetVal = RetVal.Replace( "]", "%5D" );
// Other common characters
RetVal = RetVal.Replace( " ", "%20" );
RetVal = RetVal.Replace( "\"", "%22" );
RetVal = RetVal.Replace( "-", "%2D" );
RetVal = RetVal.Replace( ".", "%2E" );
RetVal = RetVal.Replace( "<", "%3C" );
RetVal = RetVal.Replace( ">", "%3E" );
RetVal = RetVal.Replace( "\\", "%5C" );
RetVal = RetVal.Replace( "^", "%5E" );
RetVal = RetVal.Replace( "_", "%5F" );
RetVal = RetVal.Replace( "`", "%60" );
RetVal = RetVal.Replace( "{", "%7B" );
RetVal = RetVal.Replace( "|", "%7C" );
RetVal = RetVal.Replace( "}", "%7D" );
RetVal = RetVal.Replace( "~", "%7E" );
return RetVal;
}