Home > Software Tutorial > Office Software > Find Chinese characters in text using VB

Find Chinese characters in text using VB

PHPz
Release: 2024-01-07 10:10:32
forward
963 people have browsed it

VB Find Chinese Characters in Text

Private Sub Command1_Click()

Dim AR() As String, AR2() As String

sTxt = "2 01 01 00 00 00 00 00 00 00 F4 44 0C 00 08 01 29 01 03 00 00 00 00 00 00 00 F4 44 0C 00 08 01 D3 01 04 00 00 00 00 00 00 00 F4 44 0C 00 08 01 2A 01 06 00 00 00 00 00 00 00 F4 44 0C 00 08 01"

AR = Split(sTxt, "D3 01")

L = LBound(AR) 1

U = UBound(AR)

For i = L To U

tmp = Trim(AR(i))

AR2 = Split(tmp, " ")

'Output

Me.Print AR2(LBound(AR2)) & Space(2);

Next i

End Sub

VB Find Text

First question: There needs to be one button and two textboxes

Private Sub Command1_Click()

Dim a As Integer

a = InStr(1, Text1.Text, Text2.Text, vbTextCompare)

Text1.SetFocus

Text1.SelStart = a - 1

Text1.SelLength = Len(Text2.Text)

End Sub

Second question:

Private Sub Command1_Click()

Dim a As Integer

a = InStr(1, Text1.Text, Text2.Text, vbTextCompare)

If a > 0 Then

Text1.SetFocus

Text1.SelStart = a - 1

SendKeys "{down}"

End If

End Sub

Do your own research as needed, hehe

VB text search problem

3 text boxes, 1 button

text1 is the text, text2 displays the results, text3 needs to find the text

Private Sub Command1_Click()

Dim p As Long, s As Long

Dim L As String

p = -1

Do While True

s = p 2

p = InStr(s 1, Text1.Text, vbCrLf)

If p = 0 Then

Text1.SelStart = s - 1

Text1.SelLength = Len(Text1.Text) - s 1

Else

Text1.SelStart = s - 1

Text1.SelLength = p - s 1

End If

If InStr(1, Text1.SelText, Text3.Text) > 0 Then

If Text2.Text = "" Then

Text2.Text = Text1.SelText

Else

Text2.Text = Text2.Text & vbCrLf & Text1.SelText

End If

End If

If p = 0 Then Exit Do

Loop

End Sub

The above is the detailed content of Find Chinese characters in text using VB. For more information, please follow other related articles on the PHP Chinese website!

source:docexcel.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template