visual-studio-code - 编码时更改样式代码功能VScode时间优化
问题描述
我的目标是将函数更改为处理函数返回值的格式:例如;处理函数scanf()
Return value of scanf : The value EOF is returned if the end of input is reached before
either the first successful conversion or a matching failure occurs.
EOF is also returned if a read error occurs, in which case the error
indicator for the stream (see ferror(3)) is set, and errno is set to
indicate the error.
因此
scanf("%d\n",&i);
将更改为
#define RVAL(exp) do {if ((exp) == -1) { perror (#exp); exit(1); }} while (0)
...
RVAL(scanf("%d\n",&i));
因此我希望快速完成这意味着:所以我要做的是寻找“scanf”的出现并将其替换为"RVAL(scanf"
但问题是我必须添加另一个右括号
这可以快速完成吗?使用技术?还是一种风格?每当我进入scanf();
它被替换的女巫时rval(scanf());
解决方案
如果您的格式字符串中没有很多 ) ,则可以将正则表达式与 (scanf([^)]*)); 并替换为 rval(\1);
*见评论
推荐阅读
- reactjs - 无法使用命令 react-native run-android 启动应用程序
- java - Maven/Gradle 为编译设置环境变量?
- excel - VBA中的文本到列
- regex - RegEx Haystack(目标)中的通配符?
- javascript - 通过合并小模块 JSON 文件动态生成单个 JSON ReactJS React-Intl
- python - 接受连接的时间
- progressive-web-apps - 此浏览器不支持 ServiceWorkers 消息
- javascript - 更改 @Input 组件对象不会反映在父组件中
- python - Python 多处理队列管理器地址已在使用中
- katalon-studio - Katalon - 在隐身模式下录制