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

相关推荐
大白的编程日记.27 分钟前
【Linux学习笔记】Linux基本指令及其发展史分析
linux·笔记·学习
索然无味io1 小时前
Python--内置模块和开发规范(上)
开发语言·windows·笔记·python·web安全·网络安全
UQI-LIUWJ2 小时前
数据集/API 笔记:新加坡紫外线指数(UVI)
笔记
灏瀚星空2 小时前
用Python+Flask打造可视化武侠人物关系图生成器:从零到一的实战全记录
开发语言·人工智能·经验分享·笔记·python·flask
爱上妖精的尾巴2 小时前
3-7 WPS JS宏 工作表移动复制实例-2(多工作簿的多工作表合并)学习笔记
javascript·笔记·学习·wps·js宏·jsa
诗句藏于尽头4 小时前
关于签名验证不存在的错误
笔记
何政@4 小时前
Mysql面试篇笔记:
java·数据库·spring boot·笔记·mysql·面试
tt5555555555554 小时前
嵌入式学习笔记-卡尔曼滤波,PID,MicroPython
笔记·学习·嵌入式
柃歌5 小时前
【UCB CS 61B SP24】Lecture 19 & 20: Hashing & Hashing II 学习笔记
java·数据结构·笔记·学习·算法
breaksoftware5 小时前
51单片机编程学习笔记——74HC245八路三态输出双向收发器
笔记·学习·51单片机