We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Question about ASP/VBScript strings and MidB values.

Medium Priority
Last Modified: 2008-01-09
I've looked for detailed information regarding the double-byte nature of ASP/VBScript strings but I can't find anything.  I have noticed that if you get, say, Mid(s, i, 1) and MidB(s, 2 * i), 1), the values are different.  The MidB values seems to be 0 in most ASCII strings, but is sometimes the same as the Mid value in strings with extended characters in, and is sometimes something different (often a more exact value) in other extended strings (like hebrew ones).

Can anyone explain what exactly in in there?
Watch Question

MID is intended for use with languages that use the single-byte character set (SBCS), whereas MIDB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

MID always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

MIDB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, MIDB counts each character as 1.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.