Equinox Online Help - Language Reference - A to Z

Home

BeforeStr [Function]

Applies to
Syntax(TargetString, SearchString [, IgnoreCaseExpression])
Action[Function] Returns the contents of TargetString which appears before SearchString.
ScopeUsable anywhere
Notes

This function searches for SearchString in TargetString, and if found returns all the characters in TargetString before SearchString begins. If SearchString is zero length or is not found, it returns a zero length string. IgnoreCaseExpression can have any of the following values:is supplied and is nonzero, case is ignored during the search. If it is not supplied or zero, case is not ignored.

  • 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)

To specify more than one attribute add these numbers together.

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

The following example prints the string "Hello":

Print BeforeStr("Hello John", " John")

This example removes everything before the phrase "top secret", if it is found in the string:

BeforeStr(text, "top secret", 1) = ""

This example prints the string "My dog has"

Print BeforeStr("My dog has no nose","has",3)