string.capwords() 将每个单词首字母大写 代码: import string s = ' The quick brown fox jumped over the lazy dog. ' print s print string.capwords(s) 结果: The quick brown fox jumped over the lazy dog. The Quick Brown Fox Jumped Over The Lazy Dog. 请按任意键继续. . . string模…
function ReplaceDemo() { var r,re; var s="The quick brown fox jumpe dover the lazy yellow dog."; re=/\b\w+\b/g; r=s.replace(re,function(ww){ return "("+ww.slice(0,1).toUpperCase()+ww.slice(1)+")"; } ); return(r); }…
public class Da { public static void main(String[] args) { String s = "hello_*java_*world"; System.out.println("转化前:"+s); String[] strs = s.split("_\\*"); String ret = ""; for(int i = 0; i < strs.length; i++){ if…