Go to main content

extension

Returns the extension of a file.

EXTENSION

NAME

extension - Returns the extension of a file.

SYNOPSIS

extension (string "file", …)

DESCRIPTION

This function returns the extension of a file, that is the type of the file. If multiple files are specified at the beginning, it returns an array containing all the extensions.

PARAMETERS

file string : required, can be multiple files.

RETURN

Returns either an array or a string, depending on how many parameters are passed.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{ extension("toto.txt"); }}. return res=txt.
res={_{ extension("toto"); }}. return res=.
res={_{ extension(); }}. return res=.
res={_{ extension("1.txt","2.a","3.xls","4"); }}. return res=["txt","a","xls",""].

SEE ALSO

{{ include("includes/files.sn") }}

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.