Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find a year (4 digits) in a text string.
Message
From
06/08/2001 03:02:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00539775
Message ID:
00540023
Views:
25
>>>I want to locate and extract a YEAR in a text string (a reference). The year is always 4 digits as in 'the book was published in 1806 or later'. Is there an easier way to do this than a rather clumbsy parsing prg I have written.
>>
>>? val(chrtran(lcStr,chrtran(lcStr,'1234567890',''),''))
>>
>>Cetin
>
>Be aware that it'll work properly only if you don't have any other digits beside year in the string.

Sure Sergey,
OTOH w/o natural language parsing there is no way to determine if any 4 digits represent year too ('published only 1903 copies'). So I assumed digits encountered would be year.
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
Reply
Map
View

Click here to load this message in the networking platform