http://www.4js.com/online_documentation/fjs-fgl-manual-html/User/ClassStringTokenizer.html
可透過
base.StringTokenizer
大致運作的Code
01
MAIN02
DEFINE tok base.StringTokenizer03
LET tok = base.StringTokenizer.create("C:\\My Documents\\My Pictures","\\")04
WHILE tok.hasMoreTokens()05
DISPLAY tok.nextToken()06
END WHILE07
END MAIN
嘿嘿,要怎麼存成Array,方法如下
##################################################################################################
# 字串切割成Array
# @author : JeffreyWu
# @date : 2012-02-10
# @param : p_str [STRING] 來源字串 Ex:/u1/out/1234.txt
# @param : p_delimiter [STRING] 分裂字符 Ex:","
# @param : p_RemoveEmpty [BOOLEAN] 是否移除空白Array Ex:TRUE Or FALSE
# @return : p_arr [DYNAMIC ARRAY OF STRING]
# @description : 字串切割成Array
##################################################################################################
FUNCTION sl_Split(p_str,p_delimiter,p_RemoveEmpty)
DEFINE p_str STRING
DEFINE p_delimiter STRING
DEFINE p_tok base.StringTokenizer
DEFINE p_arr DYNAMIC ARRAY OF STRING
DEFINE p_RemoveEmpty BOOLEAN
DEFINE p_tokStr STRING
LET p_tok = base.StringTokenizer.createExt(p_str,p_delimiter,"",TRUE)
CALL p_arr.clear()
WHILE p_tok.hasMoreTokens()
LET p_tokStr = NULL
LET p_tokStr = p_tok.nextToken()
IF p_RemoveEmpty THEN
IF p_tokStr.getLength() > 0 THEN
CALL p_arr.appendElement()
LET p_arr[p_arr.getLength()] = p_tokStr
END IF
ELSE
CALL p_arr.appendElement()
LET p_arr[p_arr.getLength()] = p_tokStr
END IF
END WHILE
RETURN p_arr
END FUNCTION