Getting left and right expression values
Bruce Easton
bruce at stn.com
Mon Apr 23 20:14:06 PDT 2012
Stanley,
There is no 'right' function in filepro. filepro's 'mid()', as Ken
said, can
take care of all of your needs for extracting part of a string. You can
also
use a dummy or long-variable field declared with a specific length to
effectively truncate a field at the desired point (and give you a 'left'
part):
Then: declare dateportion(10,*)
Then: dateportion = datetimefield
Just curious, but possibly more importantly, why are you combining a
date and time into one field? With filepro's turbo-charged, other-worldy
abilities to sort and do math on dates and times as separate and special
data types, why ever do that? Maybe many years ago when, in
filepro, you could not create auto indexes on non-contiguous fields,
but.... Or maybe I misunderstood and you are not actually storing the
data that way....
Bruce
Bruce Easton
STN, Inc.
On 4/23/12 10:30 PM, Stanley - stanlyn-com wrote:
> Hi Ken,
>
>> Use MID(), which is the equivalent of your substr() example.
> OK, yes I see that, and thanks...
>
> Now, what about the left and right functions? How would you get those parts
> out of a string?
>
> Thanks, Stanley
>
>
>
>
>
>
>
> -----Original Message-----
> From: Kenneth Brody [mailto:kenbrody at spamcop.net]
> Sent: Monday, April 23, 2012 10:21 PM
> To: Stanley - stanlyn-com
> Cc: Filepro-list at lists.celestial.com
> Subject: Re: Getting left and right expression values
>
> On 4/23/2012 9:49 PM, Stanley - stanlyn-com wrote:
>> Hi,
> [...]
>> How do I get just the date part and/or the time part? In the other
>> languages I use we have a left and right functions that returns values
>> from the left or right as in:
> [...]
>> Also what about a function that would return a string starting at a
>> known position and for x number of characters, such as
>> lcString=substr(datetimefield, 7,6) where lcString would be equal to
>> "4/23 2"
>>
>> I use this kind of stuff all the time in other languages and don't see
>> any easy way of doing it in filePro.
> [...]
>
> Use MID(), which is the equivalent of your substr() example.
>
> --
> Kenneth Brody
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
More information about the Filepro-list
mailing list