Pfx type
Direct parent types
- SubSeq
Undocumented Direct subtypes: 3
Direct children types
- MaybePfx
Prefix that might or might not be present for (-) to succeed
- MustPfx
Prefix that must be present for ~ matching to succeed
Constructors
- Pfx(val:Any) Source: stdlib.ngs:5305
Convenience method for creating MustPfx Returns
MustPfx
Methods
- -(s:Str, pfx:Pfx) Source: stdlib.ngs:5325
Return string without the prefix. Throws MatchFail if pfx is MustPfx but s does not start with it. Parameters
s original string pfx prefix to get rid of Returns
s without pfxExample
"abcde" - Pfx("ab") # "cde" "abcde" - Pfx("xy") # MatchFail exception "abcde" - MaybePfx("xy") # "abcde"
- ~(s:Str, pfx:Pfx) Source: stdlib.ngs:5357
Check whether s starts with pfx. Returns
MatchExample
"abcde" ~ Pfx("ab") # <MatchY matches=['ab'] before= after=cde> "abcde" ~ Pfx("xy") # <MatchN >