Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

TypeScript-STL (Standard Template Library, migrated from C++)
Latest
method StringUtil.between
import { StringUtil } from "https://deno.land/x/tstl@v3.0.0/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, ?) )

const 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.