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

相关推荐
alwaysuzybaiyy1 小时前
物联网控制|计算机控制-刘川来胡乃平版|第4章:过程通道与人机接口-4.4Human-Machine Interface|课堂笔记|
笔记·物联网·powerpoint
弘毅 失败的 mian1 小时前
C++、Java 还是测试开发?
java·c++·经验分享·笔记·测试开发·技术方向·就业
AA陈超2 小时前
ASC学习笔记0019:返回给定游戏属性的当前值,如果未找到该属性则返回零。
c++·笔记·学习·游戏·ue5·虚幻引擎
星星20256 小时前
VSCode插件精选:4款高效UML绘图工具
笔记
lkbhua莱克瓦2411 小时前
Java基础——方法
java·开发语言·笔记·github·学习方法
p666666666812 小时前
STM32-bootloader引导程序跳转机制笔记
笔记·stm32·嵌入式硬件
智者知已应修善业12 小时前
【c语言蓝桥杯计算卡片题】2023-2-12
c语言·c++·经验分享·笔记·算法·蓝桥杯
Elias不吃糖14 小时前
NebulaChat项目构建笔记
linux·c++·笔记·多线程
d111111111d14 小时前
STM32外设学习-串口数据包笔记-(程序)
笔记·stm32·单片机·嵌入式硬件·学习
弘毅 失败的 mian15 小时前
编译和链接
c语言·经验分享·笔记·编程入门