Skip to content

substringBeforeLast

substringBeforeLast(string, delimiter) → string · String

Return the part of a string before the LAST occurrence of a delimiter.

  • string (required): the source string

  • delimiter (required): the delimiter to search for

utlx
substringBeforeLast("a.b.c.d", ".")      // "a.b.c"
substringBeforeLast("file.tar.gz", ".")  // "file.tar"

Released under AGPL-3.0.