]> gitweb.factorcode.org Git - factor.git/blob - extra/html/parser/utils/utils.factor
core: Add the shuffler words but without primitives.
[factor.git] / extra / html / parser / utils / utils.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel quoting sequences splitting ;
4 IN: html.parser.utils
5
6 : trim1 ( seq ch -- newseq )
7     [ [ ?head-slice drop ] [ ?tail-slice drop ] bi ] keepd like ;
8
9 : single-quote ( str -- newstr ) "'" dup surround ;
10
11 : double-quote ( str -- newstr ) "\"" dup surround ;
12
13 : quote ( str -- newstr )
14     CHAR: ' over member?
15     [ double-quote ] [ single-quote ] if ;
16
17 : ?quote ( str -- newstr ) dup quoted? [ quote ] unless ;