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

相关推荐
浩瀚地学8 分钟前
【Java】常用API(二)
java·开发语言·经验分享·笔记·学习
今儿敲了吗3 小时前
C++概述
c++·笔记
知行力3 小时前
【GitHub每日速递 20260108】告别云服务弊端,Memos隐私至上自托管笔记服务来袭!
笔记·github
wdfk_prog3 小时前
[Linux]学习笔记系列 -- [fs]sysfs
linux·笔记·学习
im_AMBER4 小时前
Leetcode 98 从链表中移除在数组中存在的节点
c++·笔记·学习·算法·leetcode·链表
jamesge20104 小时前
kafka学习笔记
笔记·学习·kafka
_李小白5 小时前
【AlohaMini学习笔记】第一天:初见AlohaMini
笔记·学习
starsky_walker5 小时前
【论文阅读笔记】--SOSP2025--Proto: A Guided Journey through Modern OS Construction
论文阅读·笔记
sunfove5 小时前
光学笔记:景深(Depth of Field)与焦深(Depth of Focus)
笔记
KhalilRuan5 小时前
操作系统-笔记
笔记