Sfx type

Suffix subsequence of a sequence

Direct parent types

SubSeq
Undocumented
Direct subtypes: 3

Direct children types

MaybeSfx
Suffix that might or might not be present for (-) to succeed
MustSfx
Suffix that must be present for ~ matching to succeed

Constructors

Sfx(val:Any) Source: stdlib.ngs:6902
Convenience method for creating MustSfx

Returns

MustSfx

Methods

-(s:Str, sfx:Sfx) Source: stdlib.ngs:6932
Return string without the suffix. Throws InvalidArgument if pfx is MustSfx but s does not end with it.

Parameters

soriginal string
sfxsuffix to get rid of

Returns

s without pfx

Example

"abcde" - Sfx("de")  # "abc"
"abcde" - Sfx("xy")  # InvalidArgument exception
"abcde" - MaybeSfx("xy")  # "abcde"
~(s:Str, sfx:Sfx) Source: stdlib.ngs:6980
Check whether s ends with sfx.

Returns

MatchResult

Example

"abcde" ~ Sfx("de")  # <MatchSuccess matches=[de] pattern=<MustSfx de> before=abc after=>
"abcde" ~ Pfx("xy")  # <MatchFailure >