How can I capitalize the first letter of each word?

前端 未结 20 2365
暖寄归人
暖寄归人 2021-01-14 12:31

I need a script in any language to capitalize the first letter of every word in a file.

Thanks for all the answers.

Stackoverflow rocks!

20条回答
  •  一向
    一向 (楼主)
    2021-01-14 12:50

    VB.Net:
    
    Dim sr As System.IO.StreamReader = New System.IO.StreamReader("c:\lowercase.txt")
    Dim str As String = sr.ReadToEnd()
    sr.Close()
    str = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(str)
    Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter("c:\TitleCase.txt")
    sw.Write(str)
    sw.Close()
    

提交回复
热议问题