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 小时前
禅道从18.3升级到21.7.6版本
笔记
Jack___Xue1 小时前
LangChain实战快速入门笔记(六)--LangChain使用之Agent
笔记·langchain·unix
零度@1 小时前
SQL 调优全解:从 20 秒到 200 ms 的 6 步实战笔记(附脚本)
数据库·笔记·sql
im_AMBER2 小时前
Leetcode 78 识别数组中的最大异常值 | 镜像对之间最小绝对距离
笔记·学习·算法·leetcode
其美杰布-富贵-李2 小时前
HDF5文件学习笔记
数据结构·笔记·学习
d111111111d4 小时前
在STM32函数指针是什么,怎么使用还有典型应用场景。
笔记·stm32·单片机·嵌入式硬件·学习·算法
静小谢4 小时前
前后台一起部署,vite配置笔记base\build
前端·javascript·笔记
ask_baidu5 小时前
Doris笔记
android·笔记
IMPYLH6 小时前
Lua 的 IO (输入/输出)模块
开发语言·笔记·后端·lua
2301_783360136 小时前
【学习笔记】关于RNA_seq和Ribo_seq技术的对比和BAM生成
笔记·学习