Skip to content

Modern String TrimEnd

Paul Squires edited this page Nov 8, 2026 · 1 revision

Home › String Library › String Slices › TrimEnd

TrimEnd

Returns a slice of the text without its trailing spaces, tabs, CRs and LFs.

Syntax

TrimEnd( v )

Notes

  • The result is a const slice of the argument, not a copy, so it lives as long as the argument does.
  • Only space, tab, carriage return and line feed are trimmed.
  • O(n) — const slice

Examples

#import "std/strings"
using strings

dim as ustring s = !"  \t padded \r\n"
print "["; TrimStart( s ); "]"       '' [padded <CR><LF>]
print "["; TrimEnd( s ); "]"         '' [  <TAB> padded]
print "["; TrimSpace( s ); "]"       '' [padded]

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

Clone this wiki locally