Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pickup first characters in a string
Message
From
25/08/2002 21:19:00
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00692996
Message ID:
00693503
Views:
34
>Dragan,
>
>Great solution! Although you need to add an IsLower() test to the construction of the string. The code below would actually cause the chrtran() to remove all the letters.

Good catch - I'd probably find this after a first try. Frankly, I've completely forgotten the purpose of this, just wanted to create a language-independent (or rather, local codepage dependent) list of valid chars.

Of course, IsUpper() and IsLower() are also working correctly with characters in the local codepage - in the locales I have used this, I haven't found anything wrong yet.

>>Actually, I'd rather make this a class, and build such a string like this, in its .init:
>>
>>
this.lcChars=""
>>for i=32 to 255
>>   lcChr=chr(i)
>>   if isalpha(lcChr) and IsLower(lcChr)
>>      this.lcChars=this.lcChars+lcChr
>>   endif
>>endfor
>>
>>I've found IsAlpha() function to be correct for codepages I used so far; having this run only once would make the speed a non-issue, and then the chrtran() would be language correct as well. And we wouldn't have to do anything to do to the app if it's moved to another language, as this would respect the local ANSI codepage setting.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform