Skip to content

Instantly share code, notes, and snippets.

@ncalm
Created September 27, 2023 16:00
Show Gist options
  • Select an option

  • Save ncalm/621f7055fed1bd5f7c0d3f6b757dc91e to your computer and use it in GitHub Desktop.

Select an option

Save ncalm/621f7055fed1bd5f7c0d3f6b757dc91e to your computer and use it in GitHub Desktop.
// trip leading chars
lstrip = LAMBDA(text, char,
BYROW(text,
LAMBDA(t, IF(LEFT(t)=char, lstrip(MID(t,2,len(t)),char), t))
)
);
// trim trailing chars
rstrip = LAMBDA(text, char,
BYROW(text,
LAMBDA(t, IF(RIGHT(t)=char, rstrip(MID(t,1,len(t)-1),char), t))
)
);
// trim both chars
strip = LAMBDA(text, char, rstrip(lstrip(text,char),char))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment