Page 1 of 1

Read three charecters after decimal

Posted: Tue Aug 08, 2006 9:46 am
by adams06
Hi,

I have to read the last three charecters after the decimal, how can i do this.

ex: 111-222.xyz
222-333-s2.abc
111-444_c_1.asd

Thanks & Regards

Posted: Tue Aug 08, 2006 9:49 am
by chulett
Is there always just one decimal point? Is is alright to take everything after it or just literally the first three characters?

Use the FIELD function to take the second field based on the dot as the delimiter. Substring afterwards to 3 if that's all you need.

Read three charecters after decimal

Posted: Tue Aug 08, 2006 10:24 am
by adams06
Hi,

I need to read the extensions of file.

i am using this code:

if Trim(Field(DSLink.field,'.',2))[1,3] = 'xyz' Then 'X' else ''

Thanks


chulett wrote:Is there always just one decimal point? Is is alright to take everything after it or just literally the first three characters?

Use the FIELD function to take the second field based on the dot as the delimiter. Substring afterwards to 3 if that's all you need.

Posted: Tue Aug 08, 2006 9:32 pm
by loveojha2
You can try
Right (DSLink.field, 3)
if you are sure of every file having an extension 3 character long.

Re: Read three charecters after decimal

Posted: Tue Aug 08, 2006 10:26 pm
by meena
Hi adams06
Can you try something like this:

Code: Select all

 
If Field(Trim(DSLink.field),'.',2)=xyz then X else ''

Posted: Wed Aug 09, 2006 12:21 am
by sb_akarmarkar
Hi,
you can try this too..

Code: Select all

 if DsLink['.',1,1] = 'xyz' then 'X' else '' 
Thanks,
Anupam