@tempots/std

substringBefore() function

substringBefore searches for the first occurrance of searchFor and returns the text before that. If searchFor is not found, an empty string is returned.

Signature:

substringBefore: (value: string, searchFor: string) => string

Parameters

Parameter

Type

Description

value

string

The string to search in.

searchFor

string

The string to search for.

Returns: string

The text before the first occurrance of searchFor or an empty string if searchFor is not found.