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

相关推荐
跨知易知识产权27 分钟前
美国专利确权是什么,和专利诉讼有什么不一样?
笔记
杨逢昌工厂6S管理30 分钟前
126-杨逢昌6S三环体系:越做越乱的现场熵增机理与基准化治理——一线现场诊断笔记
经验分享·笔记·职场和发展·学习方法
悟道书生37 分钟前
若依 RBAC 权限控制学习笔记
java·网络·笔记·sql·学习·vue
陈哈哈11111 小时前
折腾了半天,总算把 Vim 9.2 装明白了
笔记
陈哈哈11111 小时前
折腾了半天,总算把 OpenGL 的开发环境给装明白了
笔记
深圳老胡2 小时前
STM32F103 硬件 SPI 与软件 IO 模拟 SPI 最高速度差异详解
笔记·stm32·单片机·代码规范·1024程序员节
正弦波_Wave2 小时前
【Orcad原理图打印Pdf】
笔记·pdf
海绵宝宝的月光宝盒2 小时前
7-AutoCAD-参考线、多行文字、填充命令应用
经验分享·笔记·学习·职场和发展·课程设计·制造·cad
无锡银洲自动化2 小时前
汽包电极故障难发现?UDZ 智能电接点液位计调试小结
笔记·产品运营
n 55!w !1083 小时前
MySQL数据库笔记整理1
数据库·笔记·mysql