dbTalk Databases Forums  

seach character string?

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss seach character string? in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
LawyerKill
 
Posts: n/a

Default seach character string? - 05-08-2004 , 07:53 PM






LK

Hi,

I have a database that has a field with a character string and I need to search
that string and remove part of it for use on something else, but here's the
problem.

The string looks like this most times, 03136 17 .13), the part I need to
remove and use is the percentage number, in this case it's .13. I select the
field I want, put it in array, 'TEST' and extract the number like this
?substr('&TEST',12,3) and I get .13, convert is to numeric and I'm off to go.

Now here's the problem, about 30% of the time the character string can look
like this, 031 17 .10), or this 0310 20 .50) and I try to extract it using
the same function, 'substr' but I get only part of it or none of it because
it's position has changed. Now 99.99% of the time the percentage is always to
2 digits and a decimal point, '.01' in some rare case it's, '1.00' but I'm not
worried about that. Now in the database field the character strings always
starts all the way over at the left hand side of the field, if it started at
the right hand side it would be easier I may be able to use right() to get my
characters, but it doesn't.

Any ideas on how I can do what I need to do?

Thanks



Reply With Quote
  #2  
Old   
lemmebe@frednwilma.com
 
Posts: n/a

Default Re: seach character string? - 05-09-2004 , 01:17 AM






On 09 May 2004 00:53:48 GMT, lawyerkill (AT) aol (DOT) com (LawyerKill) wrote:

TEST = 031 17 .10)
? StrTran(substr(TEST, at('.', TEST)), ')')

I assume if the result is '.00', that will actually mean '1.00' and you can
just test for that.


Alan

Quote:
LK

Hi,

I have a database that has a field with a character string and I need to search
that string and remove part of it for use on something else, but here's the
problem.

The string looks like this most times, 03136 17 .13), the part I need to
remove and use is the percentage number, in this case it's .13. I select the
field I want, put it in array, 'TEST' and extract the number like this
?substr('&TEST',12,3) and I get .13, convert is to numeric and I'm off to go.

Now here's the problem, about 30% of the time the character string can look
like this, 031 17 .10), or this 0310 20 .50) and I try to extract it using
the same function, 'substr' but I get only part of it or none of it because
it's position has changed. Now 99.99% of the time the percentage is always to
2 digits and a decimal point, '.01' in some rare case it's, '1.00' but I'm not
worried about that. Now in the database field the character strings always
starts all the way over at the left hand side of the field, if it started at
the right hand side it would be easier I may be able to use right() to get my
characters, but it doesn't.

Any ideas on how I can do what I need to do?

Thanks

My real address is alan at sprint dot ca
(with a 'p' on 'alan' making it 'alanp',
and no spaces). I'm sick of email spam.


Reply With Quote
  #3  
Old   
LawyerKill
 
Posts: n/a

Default Re: seach character string? - 05-10-2004 , 08:51 AM



Quote:
On 09 May 2004 00:53:48 GMT, lawyerkill (AT) aol (DOT) com (LawyerKill) wrote:

TEST = 031 17 .10)
? StrTran(substr(TEST, at('.', TEST)), ')')

I assume if the result is '.00', that will actually mean '1.00' and you can
just test for that.

LK

That did it, you're good, thanks a lot


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.