Previous Topic: AT Function--Is User at Specified LDAP DN

Next Topic: BELOW Function--Is User Below Specified LDAP DN

BEFORE Function--Find a String

The BEFORE function finds the specified instance of a search string in a source string and returns that part of the source string that precedes the search string. If the search string is not found, then the BEFORE function returns the entire source string.

Syntax

The BEFORE function has the following format:

BEFORE(source_string, search_string[, not_case_sensitive][, n])

Parameters

The BEFORE function accepts the following parameters:

source_string (string)

search_string (string)

not_case_sensitive (Boolean)

Specifies case sensitivity. If the not_case_sensitive flag is set to FALSE or omitted, the BEFORE function searches the source string for an exact match. If the not_case_sensitive flag is set to TRUE, the function ignores case.

n (number)

Specifies the instance of the search string in the source string. If n is set to zero or one or omitted, the BEFORE function finds the first instance of the search string. Otherwise, the function finds the nth instance of the search string. If n is negative, the function begins the search at the end of the source string.

Return Value

The BEFORE function returns a string.

Example

Return_value=BEFORE('EricEric', 'r')
Return_value='E'

Return_value=BEFORE('EricEric', 'R')
Return_value='EricEric'

Return_value=BEFORE('EricEric', 'R', TRUE)
Return_value='E'

Return_value=BEFORE('EricEric', 'r', -1)
Return_value='EricE'

Return_value=BEFORE('EricEric', 'R', -1)
Return_value='EricEric'

Return_value=BEFORE('EricEric', 'R', TRUE, -1)
Return_value='EricE'

Return_value=BEFORE('EricEric', 'r', 2)
Return_value='EricE'

Return_value=BEFORE('EricEric', 'R', 2)
Return_value='EricEric'

Return_value=BEFORE('EricEric', 'R', TRUE, 2)
Return_value='EricE'

More information:

AFTER Function--Find a String

FIND Function--Return Position in String


Copyright © 2010 CA. All rights reserved. Email CA about this topic