$PBExportHeader$split.srf
$PBExportComments$字符串拆分函數
global type split from function_object
end type
forward prototypes
global function integer split (string assource, string astag, ref string aaret[])
end prototypes
global function integer split (string assource, string astag, ref string aaret[]);//
// 功能:拆分字符串
// 入參:asSource 源串
// asTag 分隔符
// aaRet[] 結果列表
//
Long i = 0, llPos, llBegin = 1
If IsNull(asSource) Then
Return 0
End If
llPos = Pos(asSource, asTag, llBegin)
Do While llPos > 0
i ++
aaRet[i] = Mid(asSource, llBegin, llPos - llBegin)
llBegin = llPos + Len(asTag)
llPos = Pos(asSource, asTag, llBegin)
Loop
If llBegin <= Len(asSource) Or i > 0 Then
i ++
aaRet[i] = Mid(asSource, llBegin, Len(asSource) - llBegin + 1)
End If
Return i
end function