[Gambas-user] Parsing error with Replace$/Instr

Rob sourceforge-raindog2 at ...94...
Sun Jan 13 22:15:02 CET 2008


On Sunday 13 January 2008 15:59, richard terry wrote:
> > You need to change all your "\"'s into "\\"'s.  
> That seems like catch22 to me, ie want Gambas to repace the string
> Doo you mean I have to do it first as replace all "\" with "\\" and
> then replace the resultant string with what I want,
> or are you saying it is impossible to do in code?

No, I really mean "You need to change all your "\"'s into "\\"'s."  
Like this:

sResult = Replace$(alltext, "\\plain\\f3\\fs24 
\\par }", "</body></html>")

Sorry for the word wrapping.  Anyway, this only applies when you 
include text as a constant in your Gambas program, as you're doing 
here.  If you load a string in from a file or something, Gambas 
doesn't interpolate it.

It may seem counter-intuitive to someone coming from VB with no 
perl/python/java/javascript/C/C++/shell scripting experience, but I 
personally would much rather write

print "Result 1\t\t0.80\n" ' than

print "Result 1" & vbTab & vbTab & "0.80" & vbCRLF '.

Rob




More information about the User mailing list