Skip to content

Modern String Between

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › String Library › String Library › Between

Between

Returns the text between two delimiters.

Syntax

Between( s, open, close [, start] [, ic] )

Notes

  • O(n*m)

Examples

#import "std/strings"
using strings

print Between( "blah (text here) blah", "(", ")" )   '' text here
print Between( "(a)(b)", "(", ")" )                  '' a -- pairs cannot cross
print Between( "blah (unclosed", "(", ")" )          '' (empty) -- both ends required

'' Wrap's inverse when you only want the inside
print Between( "<title>Report</title>", "<title>", "</title>" )    '' Report

Library: String Library
Category: String Library
Documented under: The Functions

Clone this wiki locally