Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:53 pm
by Patwos >> Tue, 10 May 2005 5:07:13 GMT
There are some formatting advantages to using Label controls instead of TextBox controls. As Allistar has already mentioned, running code to parse the caption and turn single ampsersands into double ampersands avoids this behaviour. If you don't want to go to the trouble of an external function like Allistar, you can utilise the String::scanUntil method, which is already an external method in C++, to create a reasonably efficient JADE version as follows.
Hope that helps,
Pat.
___________________________________________________________
doubleAllAmpersands() : String ;
vars
str : String ;
pos : Integer ;
begin
pos := 1 ;
while pos > 0 and pos <= self.length do
// Scan until we find an ampersand (potentially none)
str := str & self.scanUntil( "&", pos );
if pos > 0 then
// We found an ampersand, so append two ampersands to the string we // will eventually return and increment pos to continue scanning the // source string after the point at which this ampersand was found. str := str & "&&" ;
pos := pos + 1 ;
endif;
endwhile ;
// We've now either found no ampersands, or we've "doubled" all the ampersands that were in the
// source string, so lets return the final string.
return str ;
end;