将字符串转换为 AHK 中的十进制 ascii (dec) 表示形式
Convert string to decimal ascii (dec) representation in AHK
我一直在努力让它工作一段时间,调试它一直很痛苦......我 运行 遇到了几个不同的问题。
我提示用户输入如下:
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
dexStuff= ""
Loop, Parse, stuff
dexStuff:= AscToDec(%A_LoopField%)
AscToDec 函数非常简单:
AscToDec(c){
return Asc(c)
}
当我输入 "test" 作为我的字符串时,这将以 dexStuff 为 0000 结束。如果我将 AscToDec() 的调用更改为仅 MsgBox %A_LoopField%,它会在不同的弹出窗口中打印出 t e s t。
有人可以帮助我了解我在这里做错了什么吗?
我发现您的代码中有两个错误。首先,初始化 dexStuff
不是必需的,但如果您这样做,请使用 dexStuff=
或 dexStuff:=""
,而不是 dexStuff=""
,它将 dexStuff
设置为两个引号.其次,您不需要在函数调用中使用百分号取消引用 A_LoopField
。
这是您更正后的代码
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
dexStuff:="" ; := operator, not =
Loop, Parse, stuff
dexStuff:= AscToDec(A_LoopField) ; A_LoopField not %A_LoopField%
要连接输入的转换字符,请使用:
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
Loop, Parse, stuff
dexStuff := dexStuff . Asc(A_LoopField)
MsgBox %dexStuff%
我一直在努力让它工作一段时间,调试它一直很痛苦......我 运行 遇到了几个不同的问题。
我提示用户输入如下:
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
dexStuff= ""
Loop, Parse, stuff
dexStuff:= AscToDec(%A_LoopField%)
AscToDec 函数非常简单:
AscToDec(c){
return Asc(c)
}
当我输入 "test" 作为我的字符串时,这将以 dexStuff 为 0000 结束。如果我将 AscToDec() 的调用更改为仅 MsgBox %A_LoopField%,它会在不同的弹出窗口中打印出 t e s t。
有人可以帮助我了解我在这里做错了什么吗?
我发现您的代码中有两个错误。首先,初始化 dexStuff
不是必需的,但如果您这样做,请使用 dexStuff=
或 dexStuff:=""
,而不是 dexStuff=""
,它将 dexStuff
设置为两个引号.其次,您不需要在函数调用中使用百分号取消引用 A_LoopField
。
这是您更正后的代码
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
dexStuff:="" ; := operator, not =
Loop, Parse, stuff
dexStuff:= AscToDec(A_LoopField) ; A_LoopField not %A_LoopField%
要连接输入的转换字符,请使用:
InputBox, stuff, Enter information, Enter obfuscated information in the box below,,,,,,,30000,
Loop, Parse, stuff
dexStuff := dexStuff . Asc(A_LoopField)
MsgBox %dexStuff%