You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sugar/string.rkt

14 lines
442 B
Racket

#lang racket/base
(require "define/contract.rkt" "coercion.rkt")
(define+provide/contract (starts-with? str starter)
(string? string? . -> . coerce/boolean?)
(define starter-pattern (regexp (format "^~a" starter)))
(regexp-match starter-pattern str))
(define+provide/contract (ends-with? str ender)
(string? string? . -> . coerce/boolean?)
(define ender-pattern (regexp (format "~a$" ender)))
(regexp-match ender-pattern str))