heavenm 发表于 2018-9-5 17:46:21

Local $sSource = 'aaa,bb,,,ccc'
;~MsgBox(0, '源字符串', $sSource)
Local $sSRERe = StringRegExpReplace($sSource, '(?m)[' & "'" & '"]*([^,=\v' & "'" & '"]*)[' & "'" & '"]*(?:,|$)', '"\1",')
MsgBox(0, '', StringTrimRight($sSRERe,4))
一句正则搞不定,后面删除四位就OK了!~

heavenm 发表于 2018-9-5 18:03:47

本帖最后由 heavenm 于 2018-9-5 18:05 编辑

_SQLiteEx_Write($pjtDB, '表.字段', 值(可以为数组))
Func _SQLiteEx_Write($_hdb, $_table, $_vaule)
      $__table = StringRegExp($_table, '[^\.]+', 3) ;拆分表与表名,以点(.)分隔!
      If IsArray($_vaule) Then
                For $i = 0 To UBound($_vaule) - 1
                        _SQLiteEx_Write($_hdb, $_table, _ArrayToString($_vaule, ',', $i, $i))
                Next
      Else
                $__vaule = StringTrimRight(StringRegExpReplace($_vaule, '(?m)[' & "'" & '"]*([^,=\v' & "'" & '"]*)[' & "'" & '"]*(?:,|$)', '"\1",'), 4)
               $_sCommand = 'INSERT OR IGNORE INTO ' & $__table & ' (' & $__table & ') VALUES (' & $__vaule & ')'
                ConsoleWrite($_sCommand & @CRLF)
                _SQLite_Exec($_hdb, $_sCommand)
      EndIf
EndFunc   ;==>_SQLiteEx_Write
OK,又搞定个SQLITE,现在经常用SQLITE去操作,这样子方便多了!第一次写这种代码 函数里面套用自身~

kk_lee69 发表于 2018-9-5 23:06:52

https://www.jianshu.com/p/985fc3b360e1
https://www.cnblogs.com/peterYong/p/6556680.html
页: 1 [2]
查看完整版本: sqlite语法,正则替换引号