logo separator

[mkgmap-dev] New filter function trim

From WanMil wmgcnfg at web.de on Sat Apr 20 11:05:54 BST 2013

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!
WanMil


> Hi 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 at lists.mkgmap.org.uk
> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>



More information about the mkgmap-dev mailing list