且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

拆分字符串并获取值并删除Visual Basic 6.0中的值

更新时间:2023-02-18 19:53:49

您可以使用 Mid
You can use Mid


(...)提取数字如果格式是固定的。

使用 InStr(...) InstrRev(...)用于查找字符串数字部分的位置,如果您有特定的字符串来分隔字符串中的数字,并且然后使用 Mid
(...) to extract the number if the formatting is fixed.
Use the InStr(...) and InstrRev(...) functions to find the positions of the numeric part of the string if you have specific strings that delimit the number in the string, and then use Mid


()。

告诉我们可能的字符串的一般格式是(宽度已知)我们可以尝试进一步帮助。



抱歉你被困在VB6。

我的妻子已经同样的问题在她的工作。

(小公司。遗留代码。没有重写预算。)



编辑:修改以回应评论:

所以,如果字符串的开头是总是完全 AV,BC,然后它看起来像提取数字可以用:

().
Tell us what the general format of the possible strings is (with widths where known) and we can try to help further.

Sorry about you being stuck in VB6.
My wife has the same problem at her job.
(Tiny company. Legacy code. No budget for rewrite.)

revised in response to comments:
So, if the beginning of the string is always exactly "AV,BC," then it looks like extracting the number could be done with:
Dim sText as String
Dim vNumber As Double
sText = "AV,BC, 0.12345kg"
vNumber = Val(Mid