>>>Hi everybody,
>>>
>>>I have a character string representing Style which consists of the following portions:
>>>
>>>Color (1 letter with - or without -) Type (one or 2 letters) Number portion (could be any number but usually no more than 5 digits and not less than 2) then Stone (1 letter) then quality (number) then color quality (1 letter), e.g. for example:
>>>W-4568S5B
>>>E460D4
>>>E94E
>>>
>>>Now, all these portions are optional except for number portion. My task is to get the number portion first, then try to search, if we have a file with the same number, same first portion, same stone (if it was present), different quality. Then if there are no files with the same stone, I need to do other string manipulations.
>>>
>>>Can you help me to get Number portion first?
>>>
>>>Thanks in advance.
>>
>>try
>>
>>c="W-4568S5B"
>>? VAL(CHRTRAN(c,CHRTRAN(c,"0123456789"," ")," "))
>>
>>
>>the second '5' is ignored by VAL() because of the enbedded space.
>
>Hmmm, I'm getting 45685 and not 4568.
Are you replacing the characters with a space or a empty string? It should be a space.
Wait...
I was doing it wrong. try this.
c="W-4568S5B"
? VAL(CHRTRAN(c,CHRTRAN(c,"0123456789",SPACE(100)),SPACE(100)))
The CHRTRAN with default to a empty string if a coorisponding character in the third argument is not found.
Greg Reichert