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

相关推荐
泡泡鱼(敲代码中)1 小时前
MySQL基础学习笔记:从数据模型到DDL全掌握
开发语言·数据库·笔记·学习·mysql
江湖人称菠萝包2 小时前
【Windows】《深入浅出Windows API程序设计:核心编程篇》笔记-Chapter4-进程
windows·笔记
今儿敲了吗3 小时前
03停用词过滤
笔记·python
秦哈哈5 小时前
【Hello Agents】学习笔记(二)
笔记·学习·microsoft
风早爽太5 小时前
Flutter 开发笔记:share_plus 分享插件
笔记·flutter
宵时待雨6 小时前
linux笔记归纳19:网络层协议IP
linux·网络·笔记·网络协议·tcp/ip
javgo.cn6 小时前
Markune:一个开源的 Local-first Markdown 工作区
笔记·编辑器
逆境不可逃7 小时前
Pi Agent 学习笔记:不同模型如何接入同一套工具循环
笔记·学习
♪飙♪8 小时前
电气笔记——表的认识
笔记
PC2005-cloud8 小时前
Rust学习笔记:所有权、借用与生命周期——Rust的核心机制
笔记·学习·rust