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

相关推荐
Seraphina3641 分钟前
SQL注入(二)盲注
网络·数据库·经验分享·笔记·sql
白山编程大哥1 小时前
Carsim 2024.1 专业安装介绍:功能特性与应用场景详解
笔记
hss123456781 小时前
整装落地与效果图差距有多大?从毫米级误差到ENF板材的量化拆解
笔记
zhangrelay4 小时前
用ROS2Lyrical实验报告册思路重做蓝桥云课ROS1实验并改进
linux·笔记·学习·ubuntu·机器人
LHR_friendship5 小时前
HCIP课程全部内容
网络·笔记·学习·hcip·华为ensp
海绵宝宝转agent5 小时前
Pico 学习笔记 Harness 设计、历史压缩、三类目录与缓存复用
笔记·学习·缓存
xUxIAOrUIII7 小时前
日常笔记-1005-1
linux·笔记·python·macos
kaixin_啊啊8 小时前
彩谱FS-13高光谱相机学习笔记
图像处理·笔记·学习·高光谱相机
Ruannn(努力版)9 小时前
Patient/public-facing dashboards-prototype dashboard display
笔记