Hello Everyone, I only want to say thanks to the people who answered my question, and/or who repplied to it with information related to an answer. I will say that in programming, the very one thing you are trying to avoid ends up being the answer to your problems. :-)
On 8/5/13, Aaron Smith <[email protected]> wrote: > You might try a regexp (like the one explained here: > http://stackoverflow.com/questions/4598315/regex-to-match-only-uppercase-words-with-some-exceptions) > > so that you can just use the Regex Replace method. Something like: > | > string test = "myID is VIP"; > string pattern = @"((?:(?<!^)[A-Z]\b|(?<!^[A-Z0-9 > ]*)\b[A-Z0-9]+\b(?![A-Z0-9 ]$)))"; > string result = Regex.Replace(test, pattern, ",,$1"); > |||| > The pattern might need some tweaking, but you get the idea. > > Aaron > > | > On 8/1/2013 4:53 PM, Kevin Morales wrote: >> 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 > > -- > Aaron Smith > Web Development * App Development * Product Support Specialist > GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 > 260-489-3671 * gwmicro.com > > To insure that you receive proper support, please include all past > correspondence (where applicable), and any relevant information > pertinent to your situation when submitting a problem report to the GW > Micro Technical Support Team. > >
