Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/tstl/benchmark/internal/StringUtil.ts>StringUtil.between

TypeScript-STL (Standard Template Library, migrated from C++)
Go to Latest
method StringUtil.between
import { StringUtil } from "https://deno.land/x/tstl@v2.4.11/benchmark/internal/StringUtil.ts";

Generate a substring.

Extracts a substring consisting of the characters from specified start to end. It's same with str.substring( ? = (str.find(start) + start.size()), str.find(end, ?) )

let str: string = StringUtil.between("ABCD(EFGH)IJK", "(", ")");
console.log(str); // PRINTS "EFGH"
  • If start is not specified, extracts from begin of the string to end.
  • If end is not specified, extracts from start to end of the string.
  • If start and end are all omitted, returns str, itself.

Parameters

str: string

Target string to be applied between.

optional
start: string = [UNSUPPORTED]

A string for separating substring at the front.

optional
end: string = [UNSUPPORTED]

A string for separating substring at the end.

Returns

string

substring by specified terms.