用 mid 函数应该就可以。
解决方案 »
- 请问如何用VB设置本机的桌面背景为\\server\admin\1.bmp?
- realplayer控件的这两个方法是什么啊??
- 我用VB控制word,已经成功在FILE菜单下加了一个自己的菜单,怎样做到单击它打开一个窗口?
- 问树形结构模型数据库的设计问题?要求提取数据时效率高,而且数据库的结构在各种大型数据库通用,维护方便!
- 用vb写web用dll,要如何调试?
- 有知道QQQ含义的吗?进来讨论一下。
- 高分300 用socket连接某个网站,模拟发送http报文,如何使得connect长时间连接
- 请来帮忙!我想要text的内容每一秒更新一次,怎样实现?谢谢!(如下)
- 十万火急,怎样实现局域网的文件传输,只要参入,一定给高分?
- Text 控件接收字符串的换行问题?
- 我有个activex控件(ocx)有用户名跟密码 这两样我都有 问题是怎么注册呢
- 关于网络表示层加密编程--高手请进
dim ka as string,kb as string ,kc as string
ka=mid(a,5,2)
kb=mid(a,10,1)
kc=mid(a,13,2)
if ka="10" then ka="23"
if kb="D" then kb="hg"
if kc=".T" then kc=".D"
ToStrb=left(a,4) & ka & mid(a,7,3) & kb & mid(a,11,2) & kc & right(a,1)
end function
如下:
"????10???D??.t*" ==>> "????23???hg??.d*"
dim ka as string,kb as string,kc as string
ka=mid(a,5,2)
kb=mid(a,10,1)
kc=mid(a,13,2)
if ka="10" then ka="23"
if kb="D" then kb="hg"
if kc=".t" then kc=".d"
ToStrB=left(a,4) & ka & mid(7,3) & kb & mid(11,2) & kc & right(a,1)
end function
ToStrB=left(a,4) & ka & mid(a,7,3) & kb & mid(a,11,2) & kc & right(a,1)
For i = 1 To n
str4 = repl(ByVal a(i), "????10???D??.T*", "????23???hg??.D*")
Print #1, str4
Next i
Close
MsgBox "ok"
End SubPrivate Sub Form_Load()
Open "c:\temp1.txt" For Input As #1
n = 0
Do While Not EOF(1)
n = n + 1
ReDim Preserve a(n)
Input #1, a(n)
Loop
Close
Open "c:\temp2.txt" For Output As #1
End Sub
Function repl(ByVal str1 As String, str2 As String, str3 As String)
lenstr2 = Len(str2)
lstr = ""
p = 1
For j = 1 To lenstr2
x = Mid(str2, j, 1)
y = Mid(str1, j, 1)
If x = "?" Then
lstr = lstr & y
p = p + 1
ElseIf x = "*" Then
Exit For
Else
Do
z = Mid(str3, p, 1)
If InStr("?*", z) = 0 Then
lstr = lstr & z
p = p + 1
Else
Exit Do
End If
Loop
End If
Next j
If j <= lenstr2 Then
lstr = lstr + Right(str1, Len(str1) - j + 1)
End If
repl = lstr
End Function
伧促之间写出的程序不一定最优,但如果对您有所帮助将是我最大的快乐!
文件c:\temp1.txt中存放的是替代后的内容。
t = Left(s, 4) & "23" & Mid(s, 7, 3) & "hg" & Mid(s, 11, 2) & ".D" & Mid(s, 15)
If Mid(s, 5, 2) = "10" And Mid(s, 10, 1) = "D" And Mid(s, 13, 2) = ".T" Then Exit Subt = Left(s, 4) & "23" & Mid(s, 7, 3) & "hg" & Mid(s, 11, 2) & ".D" & Mid(s, 15)