Equinox Online Help - Language Reference - A to Z

Home

BetweenStr [Function]

Applies to
Syntax(TargetString, BeforeString, AfterString [, IgnoreCaseExpression])
Action[Function] Returns the contents of TargetString which appears between BeforeString and AfterString.
ScopeUsable anywhere
Notes

This function searches for BeforeString and AfterString in TargetString, and if both are found returns all the characters in TargetString between the two. If BeforeString or AfterString is not found, it returns a zero length string. If BeforeString is zero length, all of TargetString up to AfterString is returned. If AfterString is zero length, all of TargetString after BeforeString is returned IgnoreCaseExpression can have any of the following values:

  • 0 or null case is not ignored
  • 1 case is ignored
  • 2 include the first search string as part of the result (this is only available in Version 5)
  • 4 include the second search string as part of the result (this is only available in Version 5)

To specify more than one attribute add these numbers together.

CategoryString handling
See Also AfterStr_Function, AfterStr_Statement, BeforeStr_Statement, BeginsWith, BetweenStr_Statement, BeforeStr_Function
Example

The following example prints the string "dear":

Print BetweenStr("Hello dear John", "Hello ", " John")

This example replaces everything between the phrases "top secret" and "end top secret" with a notice. If "end top secret" is not found, the remainder of the document is replaced. If "top secret" is not found, no changes are made.

BeforeStr(text, "top secret", "end top secret", 1) = " TEXT REMOVED"

These examples show how the new values for ignore case expression can be used.

| Prints "has gone"

Print BetweenStr("My sister has gone to the West Indies","sister","to",2)| Prints "sister has gone"

Print BetweenStr("My sister has gone to the West Indies","sister","to",4)| Prints "has gone to"

Print BetweenStr("My sister has gone to the West Indies","sister","to",6)| Prints "sister has gone to"