Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP equivlants of VBScript
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00519401
Message ID:
00519428
Views:
14
>I was just wondering if anyone knew of the equivilants of some functions in VBScript. They are:
>
>split(string,constant) - This will split a text string into an array where the constant appears. like this example
>
>Dim MyString, MyArray, Msg
>MyString = "VBScriptXisXfun!"
>MyArray = Split(MyString, "X")
>' MyArray(0) contains "VBScript"
>' MyArray(1) contains "is"
>' MyArray(2) contains "fun!"
>
>The other is...
>filter(stringarray, value) - This will create an array with elements from the string array containing value. For example
>
>Dim MyIndex
>Dim MyArray (3)
>MyArray(0) = "Sunday"
>MyArray(1) = "Monday"
>MyArray(2) = "Tuesday"
>MyIndex = Filter(MyArray, "Mon")
>' MyIndex(0) contains "Monday"
>
>So, if anyone knew any quick VFP equivilants for these functions let me know.
>
>Thanks in advance
Eric

As far as the Split function, you can simulate it using CHRTRAN() and ALINES()
MyString = "VBScriptXisXfun!"
MyString = CHRTRAN(MyString, "X", CHR(13))
DIMENSION a_lines[1]
? ALINES(a_lines, MyString)
There's no equivalent functionality, short of using ASCAN() for the Filter function.
DIMENSION MyArray(3)
MyArray(1) = "Sunday"
MyArray(2) = "Monday"
MyArray(3) = "Tuesday"
MyIndex = ASCAN(MyArray, "Mon")
? MyArray(MyIndex)
with SET EXACT being OFF.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform