Format question
Robert Brenstein
rjb at robelko.com
Mon Jun 7 12:26:18 EDT 2004
>I have a tricky issue where I want to run a script to remove double
>spaces in the script of an object but not damage any code which is
>actually injecting it into something. To be clear, I want the
>following:
>
>set the visible of image "monkey" to true
>
>... to look like this:
>
>set the visible of image "monkey" to true
>
>... but what i don't want to do is affect any code trying to do
>something with spaces. For instance:
>
>put "Hello there" into fld 1
>
>... depending on how many times I run my code to clean the extra
>spaces between words this script can end up looking like this:
>
>put "Hellothere" into fld 1
>
>So I guess what I'm saying is I don't want to affect spaces between quotes.
>
>Any ideas?
>
>Sincerely,
>Simon
I'd (in pseudo-code)
put empty into newscript
repeat for each line in orgscript
repeat until found all quote pairs
find first and 2nd quote of each quote pair in the line using offset
and shifting the beginchar*
replace all spaces between quotes with special char that is not used
end repeat
put the line and cd after newscript
end repeat
delete last char of newscript
repeat while " " is in text
global replace of " " to " " in newscript
end repeat
replace the special char with space in nerwscript
* alternative is to keep replacing each quote with another character,
tracking its location whether it is the first or second quote in pair
instead of fiddling with beginchar and then replace this char in the
very end with quote -- this would made the scripting simpler me
thinks because the offset would always be from the beginning of line
Robert Brenstein
More information about the metacard
mailing list