Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a STRTRAN function which is not case sensitive
Message
From
30/04/2002 12:05:31
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00650635
Message ID:
00650922
Views:
34
>> is there a Strtran function (or similar) which will
>> replace text but in a case insensitive manner, e,g,
>>
>> Abc=Strtran(MyFruit,'Apples','Coca Cola')
>> Abc=Strtran(MyFruit,'apples','Coca Cola')......
>
>I have a function I use that parses through occurrances in a string using OCCURS() and AT() and then uses STUFF() to insert the replacement string into the primary string at the appropriate location. If you look for the target string in the string searched while both are converted to uppercase, you will get case-independant results. After all, AT() returns the location in the string and a location is a number and a number is independant of case!
>
>Here's my code:
>
>* change something in the clipboard text (could just as well be a variable)
>DO WHILE OCCURS("strtran(", LOWER(_CLIPTEXT))>0
>   _CLIPTEXT=STUFF( _CLIPTEXT, AT("strtran(", LOWER(_CLIPTEXT) ), ;
>      LEN( "strtran(" ), "STRT(" )
>ENDDO
>
>
>...Art
>http://members.aol.com/ARTGR/

Arthur,
Your code is good unless replacement string was lower case and searchstring was a substring of replacestring.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform