Rebol Programming/suffix?

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

USAGE:[edit | edit source]

SUFFIX? path 

DESCRIPTION:[edit | edit source]

Return the suffix (ext) of a filename or url, else NONE.

SUFFIX? is a function value.

ARGUMENTS[edit | edit source]

  • path -- (Type: any-string)

SOURCE CODE[edit | edit source]

suffix?: func [
    {Return the suffix (ext) of a filename or url, else NONE.} 
    path [any-string!]
][
    if all [
        path: find/last path #"." 
        not find path #"/"
    ] [to-file path]
]