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

相关推荐
UpUpUp……3 小时前
HTML简单语法标签(后续实操:云备份项目)
笔记·html
小彭律师3 小时前
门禁人脸识别系统详细技术文档
笔记·python
是孑然呀5 小时前
【小记】word批量生成准考证
笔记·学习·excel
毫秒AI获客9 小时前
小红书多账号运营效率优化:技术方案与自动化实践
笔记
菜一头包9 小时前
c++ std库中的文件操作学习笔记
c++·笔记·学习
moxiaoran575311 小时前
uni-app学习笔记五-vue3响应式基础
笔记·学习·uni-app
饕餮争锋12 小时前
org.slf4j.MDC介绍-笔记
java·开发语言·笔记
weixin_4481199412 小时前
Datawhale 5月llm-universe 第1次笔记
笔记
chennalC#c.h.JA Ptho12 小时前
lubuntu 系统详解
linux·经验分享·笔记·系统架构·系统安全
m0_6896182813 小时前
从海洋生物找灵感:造个机器人RoboPteropod,它能在水下干啥?
笔记·机器人