[REBOL] Re: Quote character replacement
From: rgaither:triad:rr at: 26-Feb-2001 12:37
Hi All,
> It seems if I could change the " " into { } respectively
> then I could use the block parsing features.
Here is my first run at a function to change quotes to braces
to manage long strings properly.
REBOL [
Title: "Change quotes to braces"
Author: "Rod Gaither"
File: %fixquotes.r
Date: 26-Feb-2001
Purpose: {Test utility function to prepare .df file.}
Category: [script util text 2]
]
fix-quotes: func [in-string [string!] /local new-string in-quote?] [
new-string: make string! length? in-string
in-quote?: false
foreach char in-string [
either char = #"^(22)" [
either in-quote? [
append new-string #"^}"
][
append new-string #"^{"
]
in-quote?: not in-quote?
][
append new-string char
]
]
return new-string
]
Rather plain and inefficient, waiting for much better option! :-)
FWIW, Rod.
Rod Gaither
Oak Ridge, NC - USA
[rgaither--triad--rr--com]