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

相关推荐
chushiyunen5 小时前
欧洲地理笔记
笔记
吃着火锅x唱着歌5 小时前
Effective C++ 学习笔记 条款43 学习处理模板化基类内的名称
c++·笔记·学习
GGMM78911 小时前
VX4B600100 控制板全解析:施耐德 ATV630 变频器核心控制单元详解
笔记·变频器·变频器维修
kdxiaojie13 小时前
Linux USB驱动阅读笔记(1)
linux·笔记·学习·usb
半生过往13 小时前
前端学 Java 课程笔记
java·前端·笔记
九硕智慧建筑一体化厂家13 小时前
楼宇自控|智慧建筑核心引擎!楼宇自控系统,赋能建筑高效低碳运维
运维·人工智能·笔记·智慧城市
GGMM78914 小时前
施耐德 VX5A1HC90110(VX5A1HD9011)ATV61/ATV71 90‑110KW 电源驱动板详解
笔记·变频器·变频器维修
Wang's Blog15 小时前
PostgreSQL笔记48: 全文检索与向量检索的对比与混合检索实践
笔记·postgresql·全文检索
liuyicenysabel16 小时前
Flask 个人站 iProfile 上线笔记(k3s + Nginx + Let‘s Encrypt)
笔记·nginx·flask
深蓝海拓16 小时前
基于QtPy (PySide6) 的PLC-HMI工程项目(十五)后续完善和改进:PLC端数据解析的防粘包、残包、废包、拆包
笔记·学习·plc