@tempots/std

substringBeforeLast() function

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

Signature:

substringBeforeLast: (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 last occurrance of searchFor or an empty string if searchFor is not found.