Main /
TestSyntaxHighlightingCategories: test syntax highlighting 123K Author: pete Date: xxx
Test of syntax highlighting function isDigit(integer ch) return ch>='0' and ch<='9' end function function separateHouseNumber(sequence address) address = split(address,no_empty:=true) string street, house integer h = 0 if length(address)>1 then string last = address[$] if isDigit(last[1]) then h = 1 string penult = address[$-1] if length(address)>2 and isDigit(penult[1]) and match("194",penult)!=1 then h = 2 end if elsif length(address)>2 then h = 2 end if end if if h then street = join(address[1..$-h]) house = join(address[$-h+1..$]) else street = join(address) house = "(none)" end if return {street,house} end function constant addresses = {"Plataanstraat 5", "Straat 12", "Straat 12 II", "Dr. J. Straat 12", "Dr. J. Straat 12 a", "Dr. J. Straat 12-14", "Laan 1940 - 1945 37", "Plein 1940 2", "1213-laan 11", "16 april 1944 Pad 1", "1e Kruisweg 36", "Laan 1940-'45 66", "Laan '40-'45", "Langeloƫrduinen 3 46", "Marienwaerdt 2e Dreef 2", "Provincialeweg N205 1", "Rivium 2e Straat 59.", "Nieuwe gracht 20rd", "Nieuwe gracht 20rd 2", "Nieuwe gracht 20zw /2", "Nieuwe gracht 20zw/3", "Nieuwe gracht 20 zw/4", "Bahnhofstr. 4", "Wertstr. 10", "Lindenhof 1", "Nordesch 20", "Weilstr. 6", "Harthauer Weg 2", "Mainaustr. 49", "August-Horch-Str. 3", "Marktplatz 31", "Schmidener Weg 3", "Karl-Weysser-Str. 6"} procedure main() printf(1,"Street House Number\n") printf(1,"--------------------- ------------\n") for i=1 to length(addresses) do printf(1,"%-22s %s\n", separateHouseNumber(addresses[i])) end for end procedure main() |