在 F# 中是否有一种语法更清晰的方法来执行不区分大小写的字符串比较,而不是以下方法
System.String.Equals("test", "TeSt", System.StringComparison.CurrentCultureIgnoreCase)
最佳答案
此外,您可以使用 F# type extensions力学:
> type System.String with
- member s1.icompare(s2: string) =
- System.String.Equals(s1, s2, System.StringComparison.CurrentCultureIgnoreCase);;
> "test".icompare "tEst";;
val it : bool = true
关于F# 不区分大小写的字符串比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1936767/