haebong87
发表于 2011-7-14 11:51:26
顶上去。
Subscript used with non-Array variable.:
$result = StringCompare($nums,$nums1)
$result = StringCompare($nums,$nums1^ ERROR
>Exit code: 1 Time: 2.108
提示这个,能帮忙解决一下吗?
netegg
发表于 2011-7-14 12:20:59
num1非数组变量
haebong87
发表于 2011-7-14 12:52:53
回复 32# netegg
那应该怎么改呢?
3mile
发表于 2011-7-14 13:15:01
回复 33# haebong87
#include <array.au3>
$txt="苹果|1|2|"&@CRLF _
&"西瓜|1|3|"&@CRLF _
&"香蕉|2|4|"
;====将字符串定义成多维数组====
Local $arr_master=StringSplit($txt,@CRLF,2+1)
If @error Then Exit
Local $cols=StringSplit(StringTrimRight($arr_master,1),"|",2)
$cols=UBound($cols)
Local $array[$cols]
for $i=0 to UBound($arr_master)-1
$temp=StringSplit(StringTrimRight($arr_master[$i],1),"|",2)
for $n=0 to UBound($temp)-1
$array[$i][$n]=$temp[$n]
Next
Next
_ArrayDisplay($array)
;====定义数组结束====
;====判断====
for $i=0 to UBound($array)-2
for $n=0 to UBound($array,2)-1
if $array[$i][$n]=$array[$i+1][$n] then
msgbox(0x40000,"",$array[$i][$n]&" = " & $array[$i+1][$n])
Else
msgbox(0x40000,"",$array[$i][$n]&ChrW(8800) & $array[$i+1][$n])
EndIf
Next
Next
haebong87
发表于 2011-7-14 13:17:31
回复 34# 3mile
非常感谢!!!
haebong87
发表于 2011-7-14 13:54:10
本帖最后由 haebong87 于 2011-7-14 15:02 编辑
能解释一下为什么用StringTrimRight吗?是要除掉回车吗? 还有我之前写的哪里为什么出错能解释一下吗?
haebong87
发表于 2011-7-14 14:36:18
大哥,你弄的这个有些复杂啊,第一个西瓜和苹果不应该比较才对。