[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacing substrings in strings

From: Neil Jerram
Subject: Re: Replacing substrings in strings
Date: Sat, 02 May 2009 01:29:57 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Sebastian Tennant <address@hidden> writes:

> Quoth Linas Vepstas <address@hidden>:
>> 2009/4/14 Sebastian Tennant <address@hidden>:
>>> I needed to replace two consecutive spaces in strings with ' &nbsp;' so
>> Most programming languages use regex, and so does guile:
> Of course it can be done using regexps, I'm just a little surprised
> there isn't already a replace-substring function knocking around.

There is, and I guess it's what Linas had in mind:
regexp-substitute/global (from (ice-9 regex)).

For example:

  ;; Replace forward slashes by backward ones.
  (set! path (regexp-substitute/global #f "/" path 'pre "\\" 'post))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]