[Tile-serving] [openstreetmap/osm2pgsql] Add trim(), split_unit() and split_string() Lua helper functions (#1318)
Jochen Topf
notifications at github.com
Wed Nov 11 11:11:41 UTC 2020
@joto commented on this pull request.
> @@ -116,6 +116,36 @@ function osm2pgsql.make_clean_tags_func(keys)
end
end
+-- from http://lua-users.org/wiki/StringTrim
+function osm2pgsql.trim(str)
+ local from = str:match("^%s*()")
+ return from > #str and "" or str:match(".*%S", from)
+end
+
+function osm2pgsql.split_unit(str, default_unit)
+ local val, unit = string.match(str, "^([0-9.]+) ?(%a*)$")
I had thought about that and don't see where this would be useful. `width`, `maxspeed` can only be positive. Maybe for `ele`?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1318#discussion_r521284593
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201111/a40b0ab1/attachment-0001.htm>
More information about the Tile-serving
mailing list