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

相关推荐
05候补工程师1 分钟前
【英语学习笔记】基于“底层逻辑转换”与“去动词化”的英汉互译核心方法论及写作高分公式
经验分享·笔记·学习·考研
大明者省18 分钟前
CentOS 与 Ubuntu Python 部署差异
笔记·python·ubuntu·centos
bbaydnog23 分钟前
FreeRTOS学习笔记 17:资源管理与临界区保护——优先级反转、死锁,90%的RTOS bug都跟它有关
笔记·学习·bug
fanged23 分钟前
Datasheet学习5(STM32)(TODO)
笔记
nnsix35 分钟前
设计模式 - 迭代器模式 笔记
笔记·设计模式·迭代器模式
不羁的木木35 分钟前
Form Kit(卡片开发服务)学习笔记03-卡片UI开发与数据更新
笔记·学习·ui
不羁的木木38 分钟前
Form Kit(卡片开发服务)学习笔记02-环境搭建与基础配置
笔记·学习·harmonyos
土狗TuGou44 分钟前
SQL内功笔记 · 第5篇:SQL逻辑执行顺序
数据库·笔记·后端·sql·mysql
Zklys1 小时前
Cmake的学习笔记step1
c++·笔记·学习
飞翔中文网1 小时前
Java学习笔记之接口
java·笔记·学习