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 小时前
22.ETH-智能合约-北大肖臻老师客堂笔记
笔记·区块链·智能合约
浅念-1 小时前
C++入门(2)
开发语言·c++·经验分享·笔记·学习
张人玉2 小时前
VisionPro 定位与卡尺测量学习笔记
笔记·学习·计算机视觉·vsionprp
songyuc2 小时前
【BiFormer】BiFormer: Vision Transformer with Bi-Level Routing Attention 译读笔记
笔记·transformer
觉醒大王3 小时前
强女思维:着急,是贪欲外显的相。
java·论文阅读·笔记·深度学习·学习·自然语言处理·学习方法
三水不滴3 小时前
计网:输入网址到网页显示
经验分享·笔记·计算机网络
JustDI-CM4 小时前
AI学习笔记-提示词工程
人工智能·笔记·学习
爱写bug的野原新之助4 小时前
加密摘要算法MD5、SHA、HMAC:学习笔记
笔记·学习
小乔的编程内容分享站5 小时前
C语言笔记之函数
c语言·笔记
四谎真好看6 小时前
JavaWeb学习笔记(Day13)
笔记·学习·学习笔记·javaweb