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