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:5313
Convenience method for creating MustSfx

Returns

MustSfx

Methods

-(s:Str, sfx:Sfx) Source: stdlib.ngs:5343
Return string without the suffix. Throws MatchFail 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")  # MatchFail exception
"abcde" - MaybeSfx("xy")  # "abcde"
~(s:Str, sfx:Sfx) Source: stdlib.ngs:5371
Check whether s ends with sfx.

Returns

Match

Example

"abcde" ~ Sfx("de")  # <MatchY matches=['de'] before=abc after=>
"abcde" ~ Pfx("xy")  # <MatchN >