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

相关推荐
_Kayo_41 分钟前
vue3 computed 练习笔记
前端·vue.js·笔记
TracyCoder1231 小时前
微服务框架选型学习笔记
笔记·学习·微服务
摇滚侠1 小时前
2025最新 SpringCloud 教程,Nacos-注册中心 @LoadBalanced 注解式负载均衡,笔记11
笔记·spring cloud·负载均衡
pq113_61 小时前
开源软件学习笔记 - 移植SFUD
笔记·stm32·sfud·ft4222h
hd51cc1 小时前
MFC多线程学习笔记一:用户界面线程和工作线程
笔记·学习·mfc
草莓熊Lotso1 小时前
红黑树从入门到进阶:4 条规则如何筑牢 O (logN) 效率根基?
服务器·开发语言·c++·人工智能·经验分享·笔记·后端
sheeta19985 小时前
LeetCode 每日一题笔记 日期:2025.11.24 题目:1018. 可被5整除的二进制前缀
笔记·算法·leetcode
chinesegf6 小时前
图文并茂的笔记、便签是如何用py开发的
笔记·状态模式
我先去打把游戏先11 小时前
ESP32学习笔记(基于IDF):基于OneNet的ESP32的OTA功能
笔记·物联网·学习·云计算·iphone·aws
初願致夕霞11 小时前
学习笔记——基础hash思想及其简单C++实现
笔记·学习·哈希算法