• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1461
  • Last Modified:

Question about ASP/VBScript strings and MidB values.

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?
0
LeeDerbyshire
Asked:
LeeDerbyshire
1 Solution
 
thefritterfatboyCommented:
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.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now