VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

ExtractArgument

Brett Cramer  (1 Submission)   String Manipulation   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

I use ExtractArgument (written by my friend Mike Carper) all the time. It returns an argument or token from a string based on its position within another string and a delimiter. For example: I want the "2" in the following string: "1,2,3,4,5,6,7,8,9,10".
'Sample call
'Dim sList as string
'Dim sTown as string
'sList = "POB 145,Dexter Street,Anytown,USA"
'sTown = ExtractArgument(3, sList, ",")
'sTown will be "Anytown"
I find this very useful in working with delimited files and strings, and have implemented it in INI settings as well.

Inputs
ArgNum As Integer srchstr As String Delim As String

Returns
The argument desired in a string format

Rate ExtractArgument (5(5 Vote))
ExtractArgument.bas

ExtractArgument Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters