如何在Marklogic Server中获取文件扩展名? [英] How to get file extension in Marklogic Server?
问题描述
我想在Marklogic服务器中获取上载文件的文件扩展名.我知道如何获取文件名.但这提供了文件名和扩展名,例如new.txt.但是我只希望扩展名而不是完整的文件名.如何仅获取文件扩展名?
I want to get the file extension of uploaded file in Marklogic server. I know how to get the file name. But that gives filename plus extension like new.txt. But I want only extension not the full file name. How can I get just the file extension ?
推荐答案
有很多方法可以从文件名获取文件扩展名.例如,您可以使用functx:substring-after-last($filename, '.')
或其他方法(fn:substring-after)
在点后获取子字符串.请参阅: xqueryfunctions.com
There are many methods of getting file extensions from filename. For instance you can use functx:substring-after-last($filename, '.')
or other methods (fn:substring-after)
of getting substring after dot. Please see: xqueryfunctions.com
P.S. fn:tokenize($filename, '\.')[fn:last()]
这篇关于如何在Marklogic Server中获取文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!