#include <array.au3>
$str='中文ABC123'
$fin=_han($str)
_ArrayDisplay($fin)
$fin=_han($str,1)
_ArrayDisplay($fin)
$fin=_han($str,2)
_ArrayDisplay($fin)
func _han($str,$flag=0)
local $array
if $flag>2 or $flag<0 then $flag=0
Select
case $flag=0
$array=StringRegExp($str,'[\x{4e00}-\x{9fa5}]+',3)
if UBound($array)<0 then return SetError(1,1,0)
case $flag=1
$array=StringRegExp($str,'[a-zA-Z]+',3)
if UBound($array)<0 then return SetError(1,1,0)
Case $flag=2
$array=StringRegExp($str,'[\d]+',3)
if UBound($array)<0 then return SetError(1,1,0)
EndSelect
return $array
EndFunc
|