From f2519a16beb78ee5bb400438988b58cc116fe1a5 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 7 Mar 2024 23:03:34 +0800 Subject: [PATCH] added isfilenamechar/notfilenamechar two functions in StrChar.h --- inc/hgl/type/StrChar.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/inc/hgl/type/StrChar.h b/inc/hgl/type/StrChar.h index 26f531b..e879381 100644 --- a/inc/hgl/type/StrChar.h +++ b/inc/hgl/type/StrChar.h @@ -263,6 +263,24 @@ namespace hgl return(!iscodechar(ch)); } + /** + * 测试当前字符是否为文件名可用字符(不含路径分隔符) + */ + template + const bool isfilenamechar(const T &ch) + { + return(ch=='.'||iscodechar(ch)); + } + + /** + * 测试当前字符是否不是文件名可用字符 + */ + template + const bool notfilenamechar(const T &ch) + { + return(!isfilenamechar(ch)); + } + /** * 测试当前字符是否为BASE64编码字符 */