string.substringBefore

This function returns the string that comes before the first occurrence of the second string.

Syntax

string.substringBefore(str, beforestr)

Arguments

Argument

Type

Description

str

string

Source string

beforestr

string

Characters before the first occurrence of this string need to be returned

Returns

Type

Description

string

  • String that comes before the first occurrence of the second string.

  • Zero length string if the first string does not contain the second string.

Examples

The function string.substringBefore("1999/04/01", "/") returns 1999.