如何提取在richtextbox中的句子
如何在richtextbox控件中提取一个一个的句子?
[解决办法]
dim a ,i
a=split(replace(REPLACE(RichTextBox1.Text, "? ", "。 "), "! ", "。 "), "。 ")
for i= 0 to ubound(a)
print a(i)
next
[解决办法]
Option Explicit
Dim sep() As String
Const repTemp As String = "## " '找个肯定不会在text里出现的
Private Sub cmdMake_Click()
Dim strTest As String
Dim i As Integer
Dim a
iniSep
strTest = RichTextBox1.Text
For i = 0 To UBound(sep)
strTest = Replace(strTest, sep(i), sep(i) & repTemp)
Next
a = Split(strTest, repTemp)
For i = 0 To UBound(a)
Print a(i)
Next
End Sub
Private Sub iniSep() '这里可以添加可能的句子结尾
ReDim sep(2)
sep(0) = "? "
sep(1) = "! "
sep(2) = "。 "
End Sub