September 12, 200817 yr 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 :
November 28, 201114 yr Author 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 ))))
Create an account or sign in to comment