Skip to content

Modern String TrimStart

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

Home › String Library › String Slices › TrimStart

TrimStart

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

Syntax

TrimStart( v )

Notes

  • The result is a const slice of the argument, not a copy, so it lives as long as the argument does. A slice of a temporary — a literal, a concatenation — can be printed or passed on in the same statement, not kept.
  • 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