Skip to content

Modern String EndsWith

Paul Squires edited this page Nov 8, 2026 · 6 revisions

Home › String Library › String Library › EndsWith

EndsWith

Returns true if the string ends with the given text.

Syntax

EndsWith( s, suffix [, ic] )

Notes

  • Overloads for slices take const slice, uslice or wslice arguments and copy nothing: EndsWith( v[0 to 9], "x" ). A string argument still gets the string overload.
  • O(m) — boolean

Examples

#import "std/strings"
using strings

print EndsWith( "report.txt", ".txt" )         '' true
print EndsWith( "report.TXT", ".txt", true )   '' true
print EndsWith( "report.txt", ".md" )          '' false
print EndsWith( "", "" )                       '' true -- vacuously

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

Clone this wiki locally