VB如何读取文本所有指定内容

来源:百度知道 编辑:UC知道 时间:2024/05/29 10:38:00
比如文本中有这样一段数据
AMP_U=0.00000
AMP_V=0.00000
AMP=0.00000
RADIUS=0.00000
SWEEP=0.00000
ORIGIN_U=0.00000
ORIGIN_V=0.00000
U=759.35307
V=647.45987
AMP_U=0.00000
AMP_V=0.00000
AMP=0.00000
RADIUS=0.00000
SWEEP=0.00000
ORIGIN_U=0.00000
ORIGIN_V=0.00000
U=795.92431
V=681.55598
AMP_U=0.00000
AMP_V=0.00000
AMP=0.00000
RADIUS=0.00000
SWEEP=0.00000
ORIGIN_U=0.00000
ORIGIN_V=0.00000
U=773.43199
V=726.21128
AMP_U=0.00000
AMP_V=0.00000
AMP=0.00000
RADIUS=0.00000
SWEEP=0.00000
ORIGIN_U=0.00000
ORIGIN_V=0.00000
U=785.26795
V=792.41656
通过代码把里面所有的“U”和“V”的值全部读出来,并且后面一个“U”和“V”的值减去前一个“U”和“V”的值,得到以下的效果
U759.35V647.46
U36.57V34.10
U-22.49V44.65
U11.84V66.21
文本中有N个这样的循环段,请教如何才能让这些数据相互递减
谢谢,是否可以再原来的文本行中再添加其他内容,比如一行文本是abcdedf,我想在这行后面再添加一些内容,比如是“123”,变成abcdef123

如你所愿:给多点分吧,挺麻烦的

Option Explicit

Option Base 1

Dim Databox() As String

Dim Box1() As String

Dim Box2() As String

Dim Num As Integer

Dim Num1 As Integer

Dim num2 As Integer

Private Sub Command1_Click()

Call Sort

Dim i As Integer

For i = 1 To Num1 - 2

    Print "U"; CSng(Right(Box1(i + 1), Len(Box1(i + 1)) - 2)) - CSng(Right(Box1(i), Len(Box1(i)) - 2))

    Print "V"; CSng(Right(Box2(i + 1), Len(Box2(i + 1)) - 2)) - CSng(Right(Box2(i), Len(Box2(i)) - 2))

Next i

End Sub

Private Sub Form_Load()

Op