Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vbscript 比较两个值_Vbscript - Fatal编程技术网

Vbscript 比较两个值

Vbscript 比较两个值,vbscript,Vbscript,我想比较作为字符串输入的两个值。请帮助我如何比较这些值 strA = "25.03" strB = "-25.02" Raja您可以使用val函数将它们转换为值,然后进行任何比较 valA = Val(strA) valB = Val(strB) If valA > valB Then ' Do whatever you need End If Cdbl(strA) strB Then 'do whatever' End If strA=“25.03” strB=“-25.

我想比较作为字符串输入的两个值。请帮助我如何比较这些值

strA = "25.03"
strB = "-25.02"

Raja

您可以使用val函数将它们转换为值,然后进行任何比较

valA = Val(strA)
valB = Val(strB)

If valA > valB Then
  ' Do whatever you need
End If
Cdbl(strA)

将它们转换为双倍。了解您想要执行哪种验证可能会有所帮助

绳子

strA = "25.03" strB = "-25.02" If strA > strB Then 'do whatever' End If strA=“25.03” strB=“-25.02” 如果strA>strB,则 “做任何事” 如果结束 数字无规则符号

strA = "25.03" strB = "-25.02" If Abs(strA) > Abs(strB) Then 'do whatever' End If strA=“25.03” strB=“-25.02” 如果Abs(strA)>Abs(strB),则 “做任何事” 如果结束 包括小数的数字

strA = "25.03" strB = "-25.02" If cDbl(strA) > cDbl(strB) Then 'do whatever' End If strA = "25.03" strB = "-25.02" If cInt(strA) > cInt(strB) Then 'do whatever' End If strA=“25.03” strB=“-25.02” 如果cDbl(strA)>cDbl(strB),则 “做任何事” 如果结束 不包括小数的数字

strA = "25.03" strB = "-25.02" If cDbl(strA) > cDbl(strB) Then 'do whatever' End If strA = "25.03" strB = "-25.02" If cInt(strA) > cInt(strB) Then 'do whatever' End If strA=“25.03” strB=“-25.02” 如果cInt(strA)>cInt(strB),则 “做任何事” 如果结束
更多信息和上下文将大大有助于您获得所需的答案。

VBScript没有
Val
功能。