我此处是因为要利用文件前缀字符串识别文件比如 CP1.2.csv 前缀时CP
我使用“cp”判断
QString str = CP1.2.csv
QString prefix = cp
用法一:
str.indexOf(prefix,Qt::caseInsensitive) //此处结果是-1
用法二:
str.contains(prefix,Qt::caseInsensitive) //此处结果是true
用法三:
str.startWith(prefix,Qt::caseInsensitive) //此处结果是true
我都是用了大小写不敏感,为什么indexOf' 会返回-1 ,也没有源代码可以看 ,暂且记录一下以免后续再犯