vbs字符串分割函数
程序员文章站
2022-04-29 09:36:14
复制代码 代码如下:function cutandjoin(ssource, ilong, sjoiner) dim i, n n = len(ssource) / ilo...
复制代码 代码如下:
function cutandjoin(ssource, ilong, sjoiner)
dim i, n
n = len(ssource) / ilong
if(n <> fix(n))then n = fix(n) + 1
for i = 0 to n - 1
cutandjoin = cutandjoin & mid(ssource, i * ilong + 1, ilong) & sjoiner
next
if(n > 0)then cutandjoin = left(cutandjoin, len(cutandjoin) - len(sjoiner))
end function
wscript.echo(cutandjoin("hello world!", 1, "$"))