Suppose you have a Unicode string and you want to
do something mathematical with it.
You know how to parse
DIGIT ZERO "0" through DIGIT NINE "9"
but the string may contain Unicode digits like
ARABIC-INDIC DIGIT SIX "٦"
DEVANAGARI DIGIT SEVEN
and you want to support those too.
Help here comes from the
int result = FoldString(MAP_FOLDDIGITS, originalString, -1,
You give the
function an input buffer,
either with an explicit
character count, or with
-1 to indicate
that you want to process up to and including the null
You also give it an output buffer.
And you tell it what kind of conversion you want to perform.
In our case, we ask for
which means to convert all decimal digits to
DIGIT ZERO "0" through DIGIT NINE "9".
Now you can do your magic mathematical thing with
a known number representation.
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here