我们的品牌

欢迎访问施耐德电气网站

欢迎访问我们的网站。
		
我们今天能为您提供什么帮助?
Citect字符串如何比较?
问题描述:
Citect字符串如何比较?

所属产品线:
AVEVA™ Plant SCADA

解决方法:

CITECT 字符串比较使用StrComp()函数,需要注意的是,字符串比较有两种方式:1 二进制方式比较(转换成ANSI编码进行比较);2 文本模式比较(字符比较,不区分大小写)。使用此函数比较之前要声明比较方式,详见如下示例:

Example

Option Compare Binary    
Dim vntResult as Variant
vntResult = ("CitectVBA rules!", "Citectvba Rules!") 
' returns 1 (strings unequal)

Example

Option Compare Text    
Dim vntResult as Variant
vntResult = ("CitectVBA rules!", "Citectvba Rules!") 
' returns 0 (strings equal)

定义成STRING类型时是采用转换成ANSI编码进行比较的,详见如下示例:

Return Value

Returns a variant containing an integer data type indicating the result of the string compare:

  • Returns -1 where String1 is less than String2.

  • Returns 0 where String1 is equal to String2.

  • Returns 1 where String1 is greater than String2.

  • Returns Null where String1 or String2s Null.

Example

Dim strTest1 as String
Dim strTest2 as String
Dim strTest3 as String
Dim vntComp
strTest1 = "ABCD"
strTest2 = "abcd"
strTest3 = NULL
vntComp = StrComp(strTest1, strTest2) ' Returns -1 (less than) 
vntComp = StrComp(strTest1, strTest1) ' Returns 0 (equal to) 
vntComp = StrComp(strTest2, strTest1) ' Returns 1 (greater than) 
vntComp = StrComp(strTest1, strTest3) ' Returns NULL (strTest3 is NULL)



是否有帮助?

探索更多
范围:
探索更多
范围:
  • 产品文档
  • 软件下载
  • 产品选型工具
  • 产品替代和更换
  • 帮助和联系中心
  • 查找我们的办事处
  • 获取报价
  • 施耐德电气社区
  • 人才招聘与职业发展
  • 公司介绍
  • 新闻中心
  • 投资者
  • EcoStruxure 架构与平台
  • 职位搜索
  • mySchneider一站式数字化业务平台
  • 搜索常见问题解答
    • 支持中心热线 4008101315
    • Cookie通告
    • 使用条款
    • 京ICP备05053940号-6
    • 更改您的 cookies 设置