Great idea indeed! It would be wonderful if it could be complemented by a function to return the "rest" of the tag value (i.e. the values 2-n) such that these functions could be called repeatedly to get at the second, third etc values. Then we can really do some clever things. In my mind I can also see a function to return the count of values and a value-by-index so you can also extract value[n] or the last one in the list. I am thinking about iterating through multiple ref's on a road, capturing the first value which does not start with 'E' for the cases where the normal ref has been mixed with the int_ref. True iteration would be a different challenge I think, but catering for a fixed maximum of 2-3-4 values would be easy enough.
Colin
On 2013-04-20 12:05, WanMil wrote:
Hi Franco, thanks for contributing! I think something like firstcol would be a better name. Trim sounds more like removing whitespaces. I also think that you don't have to do the trim(). All strings are trimmed during the map building process (but that can be wrong - I haven't looked through the code...). I wonder if its easily possible to configure the column number that is returned, so something like '${destination|col:2.;}' returns the second entry of destination with the column separator ;. Maybe this could be useful for other purposes? Can you also please add some documentation to your patch? Steve has written the style documentation with asciidoc which is available in SVN. It would be great if you can add some words about this new function! Have fun! WanMilHi all, I've written a new filter function called trim. It returns the first part of a value up to the first occurance of a separator. If the separator is not found it just returns the value. Example: maybe you have a values like this destination=München;Landsberg;Augsburg;Ammersee destination=Kaufbeuren;Neugablonz;Mauerstetten;Pforzen and you want just the first part "München", or "Kaufbeuren" '${destination|trim:;}' will do the trick. with destination=München/Landsberg/Augsburg/Ammersee destination=Kaufbeuren/Neugablonz/Mauerstetten/Pforzen use '${destination|trim:/}' Find attached the new TrimFilter.java a diff for ValueBuilder.java Ciao, Franco _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev