100分问一个最基本的问题

Wuxyingshu 2002-04-15 06:10:14
StrComp比较字符串
StrComp(A,B,1)

A=B是很好理解

如何为小于,如何为大于?
不是很明白

"abc"="abc"
"abcd">"abc"
"abc"<"abcd"

这样对不对?如果“abc”与“def”呢?

什么意思?我真不是很明白
...全文
76 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
bestofbest 2002-04-15
  • 打赏
  • 举报
回复
gz
pl5th2001 2002-04-15
  • 打赏
  • 举报
回复
先比第一个,再比第二个
前面如果一样,长的大
"a"<"d"
"def">"abc"
比较ascii码,C语言里就是这么定义的
xuepiaofei 2002-04-15
  • 打赏
  • 举报
回复
同意楼上的创意!
songyangk 2002-04-15
  • 打赏
  • 举报
回复
字符串比较实际上就是在比较它们的ASCII码值,你自己在理解时可以把它们当成小数间的理解,如:abc与abcd,就当成0.123与0.1234相比较,这样是不是更好理解一点
thorkhan 2002-04-15
  • 打赏
  • 举报
回复
是按AscII碼的順序
不過在模塊的開始位置妳可以加下面任何一句代碼﹐會有相應的變化

一﹑Option Compare Binary
results in string comparisons based on asort 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 < A < E < O < a < e < o

二﹑Option Compare Text
results in string comparisons based on a case-insensitive text sort order determined by your system'slocale. When the same characters are sorted using Option Compare Text, the following text sort order is produced:

(A=a) < ( A=a) < (B=b) < (E=e) < (E=e) < (Z=z) < (O=o)



具体變化參考MSDN
Wuxyingshu 2002-04-15
  • 打赏
  • 举报
回复
有道理,给分了
ayuu 2002-04-15
  • 打赏
  • 举报
回复
其实很简单,
STRCOMP函数是从第一个字符开始,从左向右依次比较的。是按照ASCII比较的。
所以,"abc"="abc", "abd">"abc" ,"abc"<"abd"
"ab">"Ab"

同样道理,"abc"<"def"
NFDSOFT 2002-04-15
  • 打赏
  • 举报
回复
你说的对,依次从第一个开始比较(按ascii码的顺序)
如:"def">"abc"
"abc">"ab"
Wuxyingshu 2002-04-15
  • 打赏
  • 举报
回复
好象这个解释不对,不如我自已开了VB试一下,不过不好意思,我已经把VB删了
Wuxyingshu 2002-04-15
  • 打赏
  • 举报
回复
如果两个不一样呢?
Wuxyingshu 2002-04-15
  • 打赏
  • 举报
回复
唔,不会没响应吧?
rushing 2002-04-15
  • 打赏
  • 举报
回复
先比第一个,再比第二个。
前面如果一样,长的大。

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧