高手帮忙!整理文本框的字母!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/06 04:30:49
在文本框输入长字母串,要求每句首个字母一定要大写,其他为小

写,并且以“.”or“?”or“!”为句子结束符,即在“.”or“?”or

“!”后的第一个字母又要大写,其他小写,比如输入“aSd.asd!

asD.asd?”按按钮后文本框输入“Asd.Asd!Asd.Asd?”
二楼的你用的函数能说明下吗?

Private Sub Command1_Click()
s = LCase(Text1.Text)
Dim re
Set re = CreateObject("VBScript.RegExp")
re.IgnoreCase = True
re.Global = True
re.Pattern = "(?:^|[\.\?\!])\s*?([a-z])"
For Each i In re.Execute(s)
n = i.FirstIndex + InStr(i.Value, i.SubMatches(0))
Mid(s, n, 1) = UCase(Mid(s, n, 1))
Next
Text1.Text = s
End Sub

在EXCEL里用proper这个函数
格式:=proper(单元格)