C++ <替换字符串中的数字>
来源:互联网 发布:证大财富淘宝贷假不假 编辑:程序博客网 时间:2024/04/30 15:21
运行结果:
Enter a string: My userID is john17 and my 4 digit pin is 1234 which is secret. My userID is john17 and my x digit pin is xxxx which is secret.
replaceDigits.cpp
#include <iostream>#include <string>using namespace std;void replaceDigits(string& s);int main() { string s; cout << "Enter a string: "; getline(cin, s); replaceDigits(s); cout << s; return 0;}void replaceDigits(string& s) { for (int i = 0; i < s.length(); i++) { if (s[i] == ' ') { while (isdigit(s[++i])) { s[i] = 'x'; } } }}
0 0
- C++ <替换字符串中的数字>
- 表示数字 (字符串替换C++)
- 字符串非数字替换 C QString方式
- c提取字符串中的数字
- C语言宏定义中的字符串替换
- c语言中的字符串替换函数
- C语言宏定义中的字符串替换
- c语言替换字符串中的子串
- Java替换汉字字符串中的数字或小数
- [字符串]字符串中的替换
- C语言中替换字符串中的子字符串(WIN)
- C语言——例程:字符串中的子字符串替换
- 删除一个字符串中的数字(C语言)
- c语言删除字符串中的数字字符
- C标准中的字符串-数字相互转换
- C语言去掉字符串中的数字
- 把字符串中的全角数字替换成半角数字 0123456789 转换成 0123456789
- 替换字符串中的空格(C++/Java实现)
- 【转】iPhone易被窃听应用三分钟即可获取所有信息--之文章
- JDK源码 -- Map篇
- [PHP]PHP函数
- hdu4616 树形dp(有限制的权值最大链)
- Apache Came组件rest的使用
- C++ <替换字符串中的数字>
- 越长大越孤单
- spring cron表达式
- 自有域名、IIS7,搭建SMTP邮件服务器
- 【黑马程序员】第三篇_关于I/O的总结
- printf 使用
- Android Studio为APP签名,提取签名的SHA1/MD5编码
- 从一个盒子模型说起
- Spring通过注解使用定时器(已经验证)