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

相关推荐
xw-busy-code14 分钟前
sass学习笔记整理
笔记·学习·sass
xuhaoyu_cpp_java9 小时前
过滤器与监听器学习
java·经验分享·笔记·学习
LegendNoTitle9 小时前
计算机三级等级考试 网络技术 选择题考点详细梳理
服务器·前端·经验分享·笔记·php
Oll Correct11 小时前
实验八:验证以太网交换机的生成树协议STP
网络·笔记
_李小白12 小时前
【OSG学习笔记】Day 2: Hello Cow
笔记·学习
鹭天12 小时前
Langchain学习笔记
笔记·学习·langchain
GLDbalala13 小时前
GPU PRO 5 - 1.2 Reducing Texture Memory Usage by 2-Channel Color Encoding 笔记
笔记
IT199513 小时前
Docker笔记-对docker-compose.yml基本认识
笔记·docker·容器
猹叉叉(学习版)14 小时前
【系统分析师_知识点整理】 1.计算机系统
笔记·软考·系统分析师