Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

in between "btwn" ( text ; first ; fo ; second ; so )


This topic is 3087 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Name & Parameters: [color:red][big] in between "btwn" ( text ; first ; fo ; second ; so ) [/big]

Description: I use this function a lot to find text, in between things.

the parameter "text" is the whole text that you're searching in.

"first" and "fo" identifies the first thing, that you're looking after. "first" is the text and "fo" is the occurrence. i.e. if you wanted to start at the 5th time a field says "name: ", first = "name: " and fo = 5. if you wanted 5th from last, fo = -5

You're second boundary is relative to the first boundary (not relative to the whole text); it's as if anything before the first boundary, doesn't exist.

You identify this second boundary with the parameters "second" and "so", similar to how you identify the first boundary.

Sample Input:

btwn ("City: Dallas State: Texas" ; "City: " ; 1 ; " State:" ; 1)

Results:

Dallas

Recursive: no

Formula:

Let (a1 =Middle ( text ;

Position (text; first; If (fo<0 ; Length (text) ; 1); fo) + Length (first)

;

Length (text));



Left (a1; Position (a1; second; If (so<0 ; Length (text) ; 1); so)-1



)) 

Required Functions:

(s): databaser

: 09/12/08

:

  • 3 years later...
Posted

I've updated this function. I think this is just a much cleaner way to write it and it probably calculates somewhat faster:

If (PatternCount (text ; first) ≥ fo and PatternCount (text ; second) ≥ so ;

Let(a=Position (text ; first ; If(fo>0 ; 1 ; Length(text)) ; fo ) + Length(first);

If (so>0 ; Middle (text ; a ; Position (text ; second ; a ; so)-a);

Middle(text ; a ;

Position(text ; second; Length(text) ; so)-a

))))

  • 4 years later...

This topic is 3087 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.