How to extract the final part of the URL's path in Haskell -
i using network.uri
parse url (string
). how can returned uri
(parseuri url
) last part of path? or there better alternatives network.uri
?
for example from: http://www.foo.com/foo1/foo2/bar.html?q=2&q2=x#tag
i "bar.html"
you can quite extract final part uri
.
extract uripath
parsed uri
, , take in reverse until hit slash.
for example,
getfinalpart :: uri -> string getfinalpart = reverse . takewhile (/='/') . reverse . uripath
Comments
Post a Comment