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.
The BEFORE function has the following format:
BEFORE(source_string, search_string[, not_case_sensitive][, n])
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.
The BEFORE function returns a string.
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'
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |