Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #59816 > unrolled thread

.re: How to split a string (or arbitrary sequence) at each occurrence of a value.

Started by"Robert L." <No_spamming@noWhere_7073.org>
First post2017-05-25 09:59 +0000
Last post2017-05-25 09:59 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.forth


Contents

  .re: How to split a string (or arbitrary sequence) at each occurrence of a value. "Robert L." <No_spamming@noWhere_7073.org> - 2017-05-25 09:59 +0000

#59816 — .re: How to split a string (or arbitrary sequence) at each occurrence of a value.

From"Robert L." <No_spamming@noWhere_7073.org>
Date2017-05-25 09:59 +0000
Subject.re: How to split a string (or arbitrary sequence) at each occurrence of a value.
Message-ID<og69ur$bbv$1@gioia.aioe.org>
> > What is the best, easiest, fastest, etc, way to split a string into 
> > substrings based on a character position.  In Emacs Lisp I would just: 
> 
> This may not be fast (I don't know), but it's straight-forward and readable. 
> 
> (defun split (string &optional (delimiter #\Space)) 
>   (with-input-from-string (*standard-input* string) 
>     (let ((*standard-output* (make-string-output-stream))) 
>       (nconc (loop for char = (read-char nil nil nil) 
>                    while char 
>                    if (char= char delimiter) 
>                      collect (get-output-stream-string *standard-output*) 
>                    else 
>                      do (write-char char)) 
>              (list (get-output-stream-string *standard-output*))))))

Racket:

(regexp-split " +" "CL is actually  COBOL  in disguise")

 => '("CL" "is" "actually" "COBOL" "in" "disguise")

In Forth?

-- 
Air China is "Racist" for Telling the Truth About Non-White London Hoods.
Air China's in-flight magazine warned passengers about dangerous non-White
London neighborhoods and created an outrage, although Chinese have been victims
of non-White crime while visiting Europe.
https://archive.org/details/youtube-B7uEbKzwbiI

[toc] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web