本帖最后由 xms77 于 2012-2-16 22:17 编辑
用正则替换,替换后少了回车,不知道怎么回事?
代码如下:Local $text = "OsMode=1" & @CRLF & _
"OpenFile1=" & @CRLF & _
"OpenFile1=" & @CRLF & _
"OpenFile2=" & @CRLF & _
"OpenFile3=" & @CRLF & _
"OpenFile4=" & @CRLF & _
"OnOffDelay_Bin1=1000.00" & @CRLF & _
"OnOffDelay_Bin2=1000.00" & @CRLF & _
"OnOffDelay_Bin3=1000.00" & @CRLF & _
"LEFT_CYL_SENSOR_SIGNAL_ENABLE=false" & @CRLF & _
"RIGHT_CYL_SENSOR_SIGNAL_ENABLE=true"
MsgBox(0,"original text", $text)
$temp = StringRegExpReplace($text, '(LEFT_CYL_SENSOR_SIGNAL_ENABLE=.+)\n', "LEFT_CYL_SENSOR_SIGNAL_ENABLE=TRUE", 1)
If Not @error Then MsgBox(0,"after replacing text",$temp)
|