[CM] mark-explode modifications
rm at fabula.de
rm at fabula.de
Thu Jun 24 04:57:47 PDT 2004
On Wed, Jun 23, 2004 at 12:19:35PM -0700, cristopher pierson ewing wrote:
> So here's my stab at the facility of naming exploded sounds after the
> original sound they were created from:
>
> ;;;------find-char
> (define (find-char string char)
> (do ((position 0)
> (i 0 (+ i 1)))
> ((= i (string-length string)) position)
> (if (char=? char (string-ref string i))
> (set! position i))))
You might want to use 'string-index'
guile> (string-index "A long and uggly string" #\i)
20
You can find such gems with:
(apropos "string")
......
For string handling i suggest using the SRFI module for strings:
guile> (use-modules (srfi srfi-13))
guile> (define (trim-name name)
... (string-drop-right name (- (string-length name) (string-index name #\.))))
guile> (trim-name "a-sound.afi")
"a-sound"
HTH Ralf Mattes
More information about the Cmdist
mailing list