请教,GUICtrlCreateEdit创建的窗口如何以回车键分割成数组?
StringSplit ( GUICtrlRead($Edit1), "\n" ,1 )分割不出来,结果是空白
好像换行不是这么表示的
{:face (198):} @CRLF -------- \r\n 文本框多行 ES_MULTILINE只认这个
@CR ---------- \r
@LF ---------\n 回复 2# veket_linux $phonenumber = StringSplit ( GUICtrlRead($Edit1), "\r\n" ,1 )
MsgBox(0,0,$phonenumber)
$phonenumber = StringSplit ( GUICtrlRead($Edit1), "\r" ,1 )
MsgBox(0,0,$phonenumber)
$phonenumber = StringSplit ( GUICtrlRead($Edit1), "\n" ,1 )
MsgBox(0,0,$phonenumber)
无论是\r\n \r 还是 \n 返回的内容都是空白{:face (198):} #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 375, 186, 192, 114)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 265, 153)
$str = "测试" & @CRLF & "StringSplit分隔字符串" & @CRLF & "得到数组"
GUICtrlSetData($Edit1, $str)
$Button1 = GUICtrlCreateButton("Button1", 296, 56, 57, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Btn_Click()
EndSwitch
WEnd
Func Btn_Click()
$phonenumber = StringSplit(GUICtrlRead($Edit1), @CRLF,1)
If IsArray($phonenumber) Then _ArrayDisplay($phonenumber)
EndFunc 回复 4# veket_linux
{:face (293):} 学习了谢谢指导
页:
[1]