Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 1.36 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Beginner logic development
  2. if(RemoveSpaces.checked)
  3. {
  4.     RemoveSpaces(string inputString);
  5.     // After removing spaces do the other operations
  6. }
  7.  
  8. else if (RemoveSpecialChars.checked)
  9. {
  10.     RemoveSpecialChars(string inputString);
  11.     // Do other processing
  12. }
  13.        
  14. public static class StringOperations
  15. {
  16.     public static string RemoveSpaces(string sourceString)
  17.     {
  18.         string convertedString = "";
  19.         //some operations
  20.         return convertedString;
  21.     }
  22.  
  23.     public static string RemoveCharacters(string sourceString, params char[] charactersToRemove)
  24.     {
  25.         string convertedString = "";
  26.         //some operations
  27.         return convertedString;
  28.     }
  29.  
  30.     public static string RemoveAnyNumbers(string sourceString)
  31.     {
  32.         string convertedString = "";
  33.         //some operations
  34.         return convertedString;
  35.     }
  36.  
  37.     public static string ConvertToCamelCase(string sourceString)
  38.     {
  39.         string convertedString = "";
  40.         //some operations
  41.         return convertedString;
  42.     }
  43. }
  44.        
  45. string start = "a b 3 4 5.7";
  46. string noSpace = start.Replace(" ", "");
  47. string noDot = noSpace.Replace(".", "");
  48. string noNumbers = Regex.Replace(noDot, "[0-9]", "");
  49.  
  50. Console.WriteLine(start);
  51. Console.WriteLine(noSpace);
  52. Console.WriteLine(noDot);
  53. Console.WriteLine(noNumbers);
  54.        
  55. "a b 3 4 5.7"  // start
  56. "ab345.7"  // noSpace
  57. "ab3457" // noDot
  58. "ab" // noNumbers