您好,欢迎访问一九零五行业门户网

PHP字符串word末字符大小写互换,字符串大小写_PHP教程

php字符串word末字符大小写互换,字符串大小写要求给出一个字符串如 “a journey of, a thousand 'miles' must can't \begin\ with a single step.” ,通过 php 程序处理变成 “a journey of, a thousand 'miles' must can't begin with a single step.”
注意:
1、每个单词最后的字符如果是大写就变成小写,如果是小写就变成大写。
2、需要考虑类似  can't 这种形式的转换。
3、标点符号(只考虑 , ' . ;)不用变化。
参考算法 测试
结果:
source:a journey of, a thousand 'miles' must can't begin with a single step.result:a journey of, a thousand 'miles' must can't begin with a single step.source:a journey of, a thousand 'miles' must can't begin with a single step. result:a journey of, a thousand 'miles' must can't begin with a single step. source:a journey of, a thousand 'miles' must can't begin with a single step. a result:a journey of, a thousand 'miles' must can't begin with a single step. a source:a journey of, a thousand 'miles' must can't begin with a single step. a bresult:a journey of, a thousand 'miles' must can't begin with a single step. a bsource:a journey of, a thousand 'miles' must can't begin with a single step. a b'result:a journey of, a thousand 'miles' must can't begin with a single step. a b'source:a journey of, a thousand 'miles' must can't begin with a single step. a bresult:a journey of, a thousand 'miles' must can't begin with a single step. a b

我们可以看到,是符合预期的。
题目来源http://blog.sijiaomao.com/?p=98,有改动(增加了can't这种),按改后的规则,原文答案全是错的。
http://www.bkjia.com/phpjc/908456.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/908456.htmltecharticlephp字符串word末字符大小写互换,字符串大小写 要求 给出一个字符串如 a journey of, a thousand 'miles' must can't \begin\ with a single step. ,通过 ph...
其它类似信息

推荐信息