找回密码
 加入
搜索
查看: 2980|回复: 5

StringIsAlNum返回为0?????

[复制链接]
发表于 2008-5-20 08:02:05 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("form1", 324, 546, 508, 164)
$ListView1 = GUICtrlCreateListView("所有列表:", 32, 56, 257, 433)
$Button1 = GUICtrlCreateButton("读取列表", 112, 8, 105, 33, 0)
$Button2 = GUICtrlCreateButton("添加", 40, 504, 105, 33, 0)
$Button3 = GUICtrlCreateButton("删除", 176, 504, 105, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=

Global $inipath = @ScriptDir & "\game.ini"
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        CheckIni()
                Case $Button2
                Case $Button3
        EndSwitch
WEnd

Func CheckIni()
        Local $ReadIni
        $ReadIni = IniReadSectionNames($inipath)
        If @error Then
                MsgBox(4096, "", "Error occurred, probably no INI file.")
        Else
                For $i = 1 To $ReadIni[0]
                        $item = GUICtrlCreateListViewItem($ReadIni[$i], $Listview1)
                Next
        EndIf
                        _GUICtrlListView_SetColumnWidth($Listview1, 160, 100)
                        GUICtrlSendMsg($Listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
                        $menu1 = GUICtrlCreateContextMenu($Listview1)
                        $Bpath = GUICtrlCreateMenuItem("Bpath", $menu1)
                        $ypath = GUICtrlCreateMenuItem("ypath", $menu1)
                        $xiugai = GUICtrlCreateMenuItem("修改xiugai ", $menu1)
                        $separator2 = GUICtrlCreateMenuItem("", $menu1, 3)
                        $bdgx = GUICtrlCreateMenuItem("bdgx", $menu1)
                        $fwgx = GUICtrlCreateMenuItem("fwgx", $menu1)
                        $showallctrl = 1
                        While 1
                                $msg = GUIGetMsg()
                                Select
                                        Case $msg = $Bpath
                                        Case $msg = $ypath
                                        Case $msg = $xiugai
                                        Case $msg = $bdgx
                                        $num = String(GUICtrlRead(GUICtrlRead($Listview1)))
                                                                                MsgBox(0,"",$num)
                                                                                MsgBox(0,"", StringIsAlNum($num))
                                        Case $msg = $fwgx
                                        Case $msg = $GUI_EVENT_CLOSE
                                                Exit
                                EndSelect
                        WEnd
EndFunc   ;==>CheckIni


[ 本帖最后由 木纳 于 2008-5-20 21:48 编辑 ]
 楼主| 发表于 2008-5-20 08:02:35 | 显示全部楼层
game.ini如下:

[打印机]

文件目录=



这段在运行到,右键弹出选中bdgx后,出现在的是“打印机|”,看清楚,是这个“|”符号的.

上次练习GUI的时候,曾遇到过数字的,请教群里的狼哥,解决了.


这回是字符的,怎么样让StringIsAlNum返回为1呢?请各位给指点下,谢谢


[ 本帖最后由 木纳 于 2008-5-20 08:04 编辑 ]
发表于 2008-5-20 15:26:48 | 显示全部楼层
用StringReplace把“|”替换掉?……其实我还没想清楚lz究竟要干什么……要“打印机”通过StringIsAlNum得出1是不可能的……或许使用not 把 0扭曲成1……???
 楼主| 发表于 2008-5-20 19:17:45 | 显示全部楼层
StringIsAlNum

检查某个字符串是否仅含有字母或数字(文字数字式字符)。
StringIsAlNum ( "字符串" )

返回值

成功: 返回值为1。
失败: 返回值为0,说明字符串含有非文字数字字符。


注意
记住,字符串中含有任何空白符都将导致 StringIsAlNum 返回 0。


[打印机] 的 StringIsAlNum 返回值是0


怎么做可以让它返回值为1呢?
纯英语字母的,是可以的;纯数字,也可以;就是纯汉字通不过了..



StringReplace,我去试试.谢谢asdf

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-5-20 20:52:10 | 显示全部楼层
这里的字符应该是翻译的问题。al应该是指a letter of the alphabet,namely,“字母”;num是数字,阿拉伯数字--综上,汉字不可能返回1……
 楼主| 发表于 2008-5-20 21:48:22 | 显示全部楼层
哦.三克油asdf
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 00:23 , Processed in 0.075805 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表