logo separator

[mkgmap-dev] New filter function trim

From Colin Smale colin.smale at xs4all.nl on Sat Apr 20 11:23:44 BST 2013

 

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!
> 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 [1]
> 
>
_______________________________________________
> mkgmap-dev mailing
list
> mkgmap-dev at lists.mkgmap.org.uk
>
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev [1]




Links:
------
[1]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130420/3f124834/attachment.html 


More information about the mkgmap-dev mailing list