awwx.ws

begins-rest0

returns the remainder of the string if the beginning matches

http://awwx.ws/begins-rest0.arc:

(def begins-rest (pattern s)
  (if (begins s pattern)
       (cut s (len pattern))))

Examples

arc> (begins-rest "abc" "abcdef")
"def"
arc> (begins-rest "abc" "abc")
""
arc> (begins-rest "abc" "defghi")
nil

Prerequisites

This hack depends on arc3.1.

License

Same as Arc.

Contact me

Twitter: awwx
Email: andrew.wilcox [at] gmail.com