lebronletchev
Programmer
Hi,
I have these function copyright by Borislav Borissov
**************example*****************
?GetTextBetween([be],;
,;
[but she's a pretty girl who happens to be as blind as a bat])
**************************************
***********************************start of function*
FUNCTION GetTextBetween
LPARAMETERS lcVar1, lcVar2, lcText
lnVar1Pos = AT(lcVar1,lcText,1)
lnVar2Pos = AT(lcVar2,lcText,1)
IF lnVar1Pos > 0 AND lnVar2Pos > 0 AND lnVar1Pos < lnVar2Pos
RETURN SUBSTR(lcText,lnVar1Pos,(lnVar2Pos-lnVar1Pos))
ELSE
RETURN []
ENDIF
ENDFUNC
************************************ end of function*
TROUBLE
_______
Occurs when the function find words in reverse order!
for example:
?GetTextBetween([bats],;
[pretty],;
[but she's a pretty girl who likes bats, happens to be as blind as a bat]).
Here it consider the "bats" and "pretty" even if in inverted order. In the above example the text between
variables are wrong, but it show them as correct!
How I change the function for searching just in right order, in other words, lcVar1 must be before lcVar2 ALWAYS.
Thanks a lot
Lebron Letchev
I have these function copyright by Borislav Borissov
**************example*****************
?GetTextBetween([be],;
![[bat] [bat] [bat]](/data/assets/smilies/bat.gif)
[but she's a pretty girl who happens to be as blind as a bat])
**************************************
***********************************start of function*
FUNCTION GetTextBetween
LPARAMETERS lcVar1, lcVar2, lcText
lnVar1Pos = AT(lcVar1,lcText,1)
lnVar2Pos = AT(lcVar2,lcText,1)
IF lnVar1Pos > 0 AND lnVar2Pos > 0 AND lnVar1Pos < lnVar2Pos
RETURN SUBSTR(lcText,lnVar1Pos,(lnVar2Pos-lnVar1Pos))
ELSE
RETURN []
ENDIF
ENDFUNC
************************************ end of function*
TROUBLE
_______
Occurs when the function find words in reverse order!
for example:
?GetTextBetween([bats],;
[pretty],;
[but she's a pretty girl who likes bats, happens to be as blind as a bat]).
Here it consider the "bats" and "pretty" even if in inverted order. In the above example the text between
variables are wrong, but it show them as correct!
How I change the function for searching just in right order, in other words, lcVar1 must be before lcVar2 ALWAYS.
Thanks a lot
Lebron Letchev