Re: Replacing substrings in strings

2009-04-14 Thread Linas Vepstas
2009/4/14 Sebastian Tennant : > Hi Guilers, > > I needed to replace two consecutive spaces in strings with '  ' so Most programming languages use regex, and so does guile: http://www.gnu.org/software/guile/manual/html_node/Regular-Expressions.html --linas

Replacing substrings in strings

2009-04-14 Thread Sebastian Tennant
Hi Guilers, I needed to replace two consecutive spaces in strings with '  ' so I came up with this: (define (replace-substring s t u) "Return string S with all occurrences of string T replaced by string U." (let ((rv "")) (let loop ((r s)) ; r for 'remaining' (let ((a 0) (b 0))