Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STRTRANS and Slashes
Message
 
 
To
10/12/2007 17:08:10
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01274617
Message ID:
01274621
Views:
13
>I need to make sure that there are two slashes only in a textbox value. It usually would start with only 1 slash, so it would be increased to two, but over time it was replacing the doubles with 4, etc. This code in the LostFocus seems to work, but I know it's not the best way. Any ideas? Thanks!
>
>
>THISFORM.DataDir = STRTRAN(THIS.Value,'\','\\')
>THISFORM.DataDir = STRTRAN(THIS.Value,'\\\','\\')
>
That's a tough one from the first glance. I would probably go with regular expressions, but I'm not sure it's easy to create a pattern.

Your original code is easy to break with

ABC\\DEFG

You need to do it in a loop...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform