在vb6.0中在vb中实现单词倒排操作,如:I am a student 处理后是:student a am I,还有个问题就是:每行视为一个字符串,顺序将串中字母“o”左边的字符串移到整个字符串的右边,然后将“o”删除,直

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 10:30:34

在vb6.0中在vb中实现单词倒排操作,如:I am a student 处理后是:student a am I,还有个问题就是:每行视为一个字符串,顺序将串中字母“o”左边的字符串移到整个字符串的右边,然后将“o”删除,直
在vb6.0中在vb中实现单词倒排操作,如:I am a student 处理后是:student a am I,
还有个问题就是:每行视为一个字符串,顺序将串中字母“o”左边的字符串移到整个字符串的右边,然后将“o”删除,直到删除字符串中所有字母“o”为止.
例如,输入原文如下:
You can create an index on any field.
you have the correct record.
“删o移动”的处理结果如下:
n any field.Yu can create an index
rd.yu have the crrect rec
俩问题都是在vb6.0中完成的,请问该如何写代码?

在vb6.0中在vb中实现单词倒排操作,如:I am a student 处理后是:student a am I,还有个问题就是:每行视为一个字符串,顺序将串中字母“o”左边的字符串移到整个字符串的右边,然后将“o”删除,直
'新建工程-添加4个text,2个Command
'粘贴下面代码
..
'单词倒排
Private Sub Command1_Click()
Dim s
Text2.Text = ""
s = Split(Text1.Text," ")
For i = UBound(s) To 0 Step -1
Text2.Text = Text2.Text + s(i) + " "
Next i
Text2.Text = Mid(Text2.Text,1,Len(Text2.Text) - 1)
End Sub
'单词移动
Private Sub Command2_Click()
Text4.Text = ""
Dim s
s = Text3.Text
For i = 1 To Len(Text3.Text)
If Mid(Text3.Text,i,1) = "o" Then
s = Mid(s,InStr(1,s,"o") + 1) + Mid(s,1,InStr(1,s,"o") - 1)
Text4.Text = s
End If
Next i
End Sub
Private Sub Form_Load()
Text1.Text = "I am a student"
Text3.Text = "You can create an index on any field."
End Sub