Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case insensitive strtran()
Message
From
25/04/2001 15:04:56
 
 
To
25/04/2001 14:12:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00499747
Message ID:
00499781
Views:
37
>Hi All,
>
>Has anyone written a case insensitive STRTRAN() replacement.
>
>NO, I can't just use VFP 7!
>
>BOb

You mean to replace, e.g., "VALUE" or "value"
or
"VALUE" or "Value" or "vAlUe", etc.?
The first is easy
lcReplace="Test"
lcExpression="This is a test TEST"
? Strtran(Strtran(lcExpression, Lower(lcReplace), lcReplace), Upper(lcReplace), lcReplace)
You could use a VB object to do this.
e.g., create a VB ActiveX dll and a class called whatever you like (mine is VBStuff.VBFunctions)
add this method
Function StrTranC(ByVal cExpression As String, _
        ByVal cFind As String, _
        ByVal cReplace As String) As String

    StrTranC = Replace(cExpression, cFind, cReplace, , , vbTextCompare)

End Function
In VFP, call it like this:
ox=CreateObject("VBStuff.VBFunctions")
? ox.StrTranC("This is a tEsT", "test", "Test")
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform