REBOL Programming/undirize

From Wikibooks, open books for an open world
< REBOL Programming
Jump to: navigation, search

USAGE:[edit]

UNDIRIZE path 

DESCRIPTION:[edit]

Returns a copy of the path with any trailing "/" removed.

UNDIRIZE is a function value.

ARGUMENTS[edit]

  • path -- (Type: file string url)

SOURCE CODE[edit]

undirize: func [
    {Returns a copy of the path with any trailing "/" removed.} 
    path [file! string! url!]
][
    path: copy path 
    if #"/" = pick path length? path [clear back tail path] 
    path
]