vba - mid()=foo in VBS? -


in vba , vb6 can assign mid example mid(str,1,1)="a" in vbs doesn't work. need because string concatenation freakin' slow here actual code hacked real quick

function fastxmlencode(str)     dim strlen     strlen = len(str)     dim buf     dim varptr     dim     dim j     dim charlen     varptr = 1     buf = space(strlen * 7)     dim char     = 1 strlen         char = cstr(asc(mid(str, i, 1)))         charlen = len(char)         mid(buf, varptr, 2) = "&#"         varptr = varptr + 2         mid(buf, varptr, charlen) = char         varptr = varptr + charlen         mid(buf, varptr, 1) = ";"         varptr = varptr + 1     next     fastxmlencode = trim(buf) end function 

how can work in vbs?

authoritative source explicitly stating it's not available in vbscript:

visual basic applications features not in vbscript:

strings: fixed-length strings lset, rset mid statement strconv

vba has both mid statement , mid function. vbscript has mid function.

the 1 other option have if stuck doing in vbscript make api calls. since comfortable working directly string buffer might not big jump you. page should started: string functions

sorry, looks api calls out, too: rube goldberg memorial scripting page: direct api calls unless want write activex wrapper calls, we're starting awful lot of work (and additional maintenance requirements) now.


Comments

Popular posts from this blog

how to build hyperlink for query string in php -

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

queue - mq_receive: message too long -