[Gambas-user] formatted output out of sql

Rob sourceforge-raindog2 at ...94...
Tue May 11 19:45:08 CEST 2004


On Tuesday 11 May 2004 13:31, Tim Hanschen wrote:
> Well, I don't want to use SQL if it is not necessary... if you
> have an other idea let me know.

If I were producing fixed-length output, which is what I assume 
you were trying to do, I would do something like

function pad(instring as String, maxlen as Integer) as String

	return left(instring & string(maxlen, " "), maxlen)

end

...

print pad(rec["lastname"], 40) & pad(rec["firstname"], 40)

You could do the same thing with right justification by putting 
the spaces in front of instring and using right instead of left.

Rob





More information about the User mailing list