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

相关推荐
守.护7 小时前
云计算学习笔记——HTTP服务、NFS服务篇
笔记·学习·云计算
wdfk_prog7 小时前
[Linux]学习笔记系列 -- lib/dump_stack.c 栈回溯打印(Stack Trace Dumping) 内核调试与错误诊断的基石
linux·运维·服务器·c语言·笔记·学习
i.ajls7 小时前
无监督学习,推荐系统以及强化学习笔记
笔记·学习·机器学习
聆风吟º8 小时前
【Spring Boot 报错已解决】Web server failed to start. Port 8080 was already in use.
spring boot·笔记·技术干货
Suckerbin8 小时前
LAMPSecurity: CTF6靶场渗透
笔记·安全·web安全·网络安全
特种加菲猫8 小时前
并发编程的守护者:信号量与日志策略模式解析
linux·笔记·策略模式
赶飞机偏偏下雨9 小时前
【Java笔记】单例模式
java·笔记·单例模式
GoldenaArcher9 小时前
OpenAPI Specification 系列笔记 III
笔记
happilyaaa10 小时前
B站 韩顺平 笔记 (Day 27)
笔记
我真的是大笨蛋15 小时前
K8S-Pod(下)
java·笔记·云原生·容器·kubernetes