The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.

From:

 Kevin Morales <kevinmorales2114@gmail.com>

Subject:

 Question about string parsing.

Date:

 Thu, Aug 1, 2013 4:53:39 pm
Dear GW Scripters,

I am working on a component that requires Braille translation.
I am trying to write an algorythm in C# that will add capital signs
appropriately.
I would like the acronym VIP to be translated as ,,VIP, or the word
myID to my,,ID.
Can anybody assist me as to how to do this?
I will supply my code so far:


private static void applyCapitalizationRules(StringBuilder text)
{ // Begin applyCapitalizationRules

int capitalsCounter = 0;
// Note: Regex.Split(text.ToString(), @"W+")
// This line means that We'll get an array with just the words in the
supplied parameter of the method.
foreach ( string word in Regex.Split(text.ToString(), @"W+") )
{ // Begin foreach
if ( word == word.ToUpper() )
{ // Begin if
text.Capacity += 2;
text.Replace(word, string.Format(","+word);
} // End if
else
{ // Begin else
for (int i = 0; i <= word.Length; i++)
{ // Begin for
// Not sure of what to do next. :-)
} // End for
} // End else
} // En foreach
} // End applyCapitalizationRules
Thanks a lot in advance,
Kevin