欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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, "$"))