lilypond-user
[Top][All Lists]
Advanced

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

Re: how to display \" in string without starting/ending "-signs?


From: David Kastrup
Subject: Re: how to display \" in string without starting/ending "-signs?
Date: Sun, 13 Mar 2016 16:52:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> Hi all,
>
> consider the following string:  "bar\"foo\"buzz"
> I want to display it like: bar\"foo\"buzz

What for?  The answer depends on your reason.  It would be possible to
just format it in print syntax and hack off the first and last
character.  However, formatting in print syntax entails more changes
than just " -> \" and this may either be _exactly_ what you actually
want, or not at all.

> I can make it work with:
> (display (string-join (string-split strg #\" )  "\\\""))
> ->bar\"foo\"buzz
>
> Is there any better way?

Well, if you are just out for ", you can use

(regexp-substitute/global (current-output-port) "\"" "wawawa\"wawa\"" 'pre 
"\\\"" 'post)

Use #f instead of (current-output-port) if you don't want to output to a
port but have a string returned.

The regexp routines from Guile are pretty awkward to use.

-- 
David Kastrup



reply via email to

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