guile-user
[Top][All Lists]
Advanced

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

How to effectively insert into string?


From: Jan Synacek
Subject: How to effectively insert into string?
Date: Mon, 9 Mar 2020 13:20:45 +0100

Hello,

how do I write a function that inserts into a string (or deletes from a
string) effectively in guile? There's some mention about how strings are
implemented in the info manual, but it's not really clear to me. Is it
necessary to implement a gap buffer / rope / something similar, or can it
effectively be achieved with only guile's strings?

I also have a related question. Let's say I have a spec file (as in the one
used by RPM) and I need to add several lines to the section of patches
which looks like this:

...
Patch0001: ...
Patch0002: ...
Patch0003: ...
...

That is, I'd like to process the file and add "Patch0004...\nPatch0005..."
after the Patch0003 line, then save the file. What is the best way to do
this in guile? Is it better to read the entire file and then use something
like regexp-substitute or is there a better way?

Thank you,
-- 
Jan Synacek
Software Engineer, Red Hat


reply via email to

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