我在这里阅读了一篇非常有用的帖子How do I make the first letter of a string uppercase in JavaScript?,我很好奇使用VBScript的一个很好的解决方案。
答案 0 :(得分:11)
>> s = "first word of string"
>> WScript.Echo UCase(Left(s, 1)) & Mid(s, 2)
>>
First word of string
答案 1 :(得分:1)
str = "mY nAME iS sACHIN"
arrStr = split(str," ")
For i=0 to ubound(arrStr)
word = lcase(trim(arrStr(i)))
word = replace(word,mid(word,1,1),chr(asc(mid(word,1,1))-32),1,1)
str1 = str1 & word & " "
next
msgbox trim(str1)
输出:我的名字是萨钦
答案 2 :(得分:0)
str = "mY nAME iS sACHIN"
arrStr = split(str," ")
For i=0 to ubound(arrStr)
word = lcase(trim(arrStr(i)))
word = replace(word,mid(word,1,1),ucase(mid(word,1,1)),1,1)
str1 = str1 & word & " "
next
msgbox trim(str1)