简体   繁体   English

在C ++中从CString转义特殊字符

[英]Escape special characters from CString in C++

I would like to escape special characters from my CString variable. 我想从我的CString变量中转义特殊字符。 For eg: If the string contains "Te#st$ Va%lue", the out string should contain escape characters for the special characters('#', '$' and '%'). 例如:如果字符串包含“ Te#st $ Va%lue”,则输出字符串应包含特殊字符的转义字符(“#”,“ $”和“%”)。

How should I do this in single function to escape all the special characters? 如何在单个函数中执行此操作以转义所有特殊字符?

This is typically solved by implementing a fairly simple transducer . 这通常可以通过实现一个相当简单的传感器来解决。 I will try to provide more details later. 稍后,我将尝试提供更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM