Rebol Programming/undirize

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

UNDIRIZE path 

DESCRIPTION:[edit | edit source]

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

UNDIRIZE is a function value.

ARGUMENTS[edit | edit source]

  • path -- (Type: file string url)

SOURCE CODE[edit | edit source]

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
]