当前位置: 代码迷 >> VC >> 文字处理有关问题
  详细解决方案

文字处理有关问题

热度:6225   发布时间:2013-02-25 00:00:00.0
文字处理问题
字符串处理,满足以下要求:
1、单词首字母转换为大写
  输入 hello word 
  输出 Hello WORD 


2、数字与字母或字母与数字间均用下划线(_)隔开
   
this is zhe first time to go shopping buy 8apple 
 this is zhe first time to go shopping buy 8_apple 
   

3、多个空格转换为一个

  输入 wo shi yi ming he ge xue sheng 
  输出 wo shi yi ming he ge xue sheng

------解决方案--------------------------------------------------------
要满足多种条件,用正则表达式吧
------解决方案--------------------------------------------------------
楼上的给个详细的啊 正则表达式 貌似好深奥啊
------解决方案--------------------------------------------------------
第一个参考js版
http://ming358721.blog.51cto.com/2306530/414483