vbscript - Convert alphanumeric string to given values for each, then add them for a total number -


i'm having difficult time wording i'm doing, have variable length alphanumeric data being fed program, , want find out total "pixel width" of string, based on fixed list of = 3 pxl, b = 3 pxl, = 1 pxl, etc...

i list of pixel values of each letter , number, , script take input: ex. "this string", , convert numbers i've assigned add them , total them giving me total sum output (i assign number space " " , punctuation).

so: "this string" "3+3+1+3+2+1+3+2+3+3+3+2+3+3+3+1+3+3 = 45"

you need table/array of pixel widthes indexed ascii codes. can loop on string's characters , sum widthes. like:

>> dim a(255) >> a(65) = 3 >> a(66) = 3 >> a(asc("i")) = 1 >> s = "aib" >> n = 0 >> p = 1 len(s) >>     n = n + a(asc(mid(s, p, 1))) >> next >> wscript.echo n >> 7 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -