fun

does this do it?

(pack (mapcon '((X) (ifn (= '(" " " ") (head 2 X)) (cons (car X)))) (chop
S)))
-> " this contains 2 consecutive spaces "


On Feb 17, 2017 5:23 PM, "dean" <deangwillia...@gmail.com> wrote:

> I've done this and it works but...is there a slicker way :)
>
> (setq S " this contains 2  consecutive spaces ")
>
> (de shrink (Str)
>    #can't clip before inner pack so need to pack, chop, clip and re-pack
>    (pack
>       (clip
>          (chop
>             (pack
>                (let (Last_ch " ")
>                (make
>                   (for Ch (chop Str)
>                      (if (<> Ch " ")
>                         (if (= Last_ch " ")
>                            (link (pack " " Ch))
>                            (link Ch)))
>                      (setq Last_ch Ch)))))))))
>
>
> (prinl "'" (shrink S) "'")
>
> #'this contains 2 consecutive spaces'
>
>
>

Reply via email to