Hi!
Probably this will require to extract numbers from the string:
str="PRICE<=5000000"
llNotFound = .T.
lnPos = 1
do while llNotFound
lnNumPos = at('~',chrtran(str,"0123456789.-+,","~"),lnPos)
if lnNumPos=0
return str
endif
if substr(str,lnNumPos-1,1) $ "<>=#!( ,;:'"+'"'
llNotFound = .F.
else
lnPos = lnPos +1
endif
enddo
lnNumPosEnd = lnNumPos
do while substr(str,lnNumPosEnd,1) $ "0123456789.-+,"
lnNumPosEnd = lnNumPosEnd + 1
enddo
return left(str,lnNumPos-1) + PreFormat(val(substr(str,lnNumPos,lnNumPosEnd-lnNumPos+1))) + substr(str,lnNumPosEnd)
PreFormat - is your function to pre-format a number to your desired user-friendly format.
Is that what you meant?
>>Hi!
>>
>>Nadya, uaually I do this from another way - build a string the way tyhat it is represented correctly. In my filtering controls I have 2 methods. First is to gather comparison expression from all filtering controls to apply filter. Second - to gather the same, but in user-friendly form. This way you will not require to invent complex string processing, just build it by 2 ways - filtering control returns required string on request ;)
>>
>>Above you can also replace "control" by "code fragment" that responsible for generating filter expression.
>
>Actually, you're right and I even have these methods already. But neverless, this would be an interesting string problem to solve :)
>
>
>>>Hi everybody,
>>>
>>>I have a form, where the user can make selection criteria. On this form I have a button, which says: "Show criteria".
>>>If I have this kind of criterion, for example, PRICE<=5000000, I'm thinking about presenting it as PRICE<=$5,000,000. My question is: how can I perform such string modifications? As you understand, I return each criterion as a string lcCrit, so it might be "between(price, 100,1000000)" for another example.
>>>
>>>Thanks in advance.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.