Excel - Binary和Text两种Compare方法

Option Compare statement
VBA里可以定义默认使用的compare方法:
' Set the string comparison method to Binary.
Option Compare Binary ' That is, "AAA" is less than "aaa".
' Set the string comparison method to Text.
Option Compare Text ' That is, "AAA" is equal to "aaa".
This example uses the Option Compare statement to set the default string comparison method. The Option Compare statement is used at the module level only.
If used, the Option Compare statement must appear in a module before any procedures.
If a module doesn't include an Option Compare statement, the default text comparison method is Binary.

  • Option Compare Binary results in string comparisons based on a sort order derived from the internal binary representations of the characters. In Microsoft Windows, sort order is determined by the code page. A typical binary sort order is shown in the following example:

A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø

  • Option Compare Text results in string comparisons based on a case-insensitive text sort order determined by your system's locale. When the same characters are sorted by using Option Compare Text, the following text sort order is produced:

(A=a) < ( À=à) < (B=b) < (E=e) < (Ê=ê) < (Z=z) < (Ø=ø)
参考:
Option Compare statement (VBA) | Microsoft Learn

相关推荐
摇滚侠1 小时前
Spring Boot3零基础教程,Reactive-Stream 发布订阅写法,笔记104 笔记105
java·spring boot·笔记
循环过三天7 小时前
3.4、Python-集合
开发语言·笔记·python·学习·算法
昌sit!9 小时前
Linux系统性基础学习笔记
linux·笔记·学习
没有钱的钱仔9 小时前
机器学习笔记
人工智能·笔记·机器学习
好望角雾眠9 小时前
第四阶段C#通讯开发-9:网络协议Modbus下的TCP与UDP
网络·笔记·网络协议·tcp/ip·c#·modbus
仰望—星空10 小时前
MiniEngine学习笔记 : CommandListManager
c++·windows·笔记·学习·cg·direct3d
下午见。11 小时前
C语言结构体入门:定义、访问与传参全解析
c语言·笔记·学习
im_AMBER11 小时前
React 16
前端·笔记·学习·react.js·前端框架
lkbhua莱克瓦2411 小时前
Java基础——常用算法5
java·开发语言·笔记·github
摇滚侠12 小时前
Spring Boot3零基础教程,响应式编程的模型,笔记109
java·spring boot·笔记