Advertisement
Guest User

Untitled

a guest
May 30th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. public unsafe static string[] PreProcessBook(string Input, int *MaximumLength)
  2.         {
  3.             *MaximumLength = 0;
  4.  
  5.             HashSet<string> Output = new HashSet<string>();
  6.             StringBuilder builder = new StringBuilder(50);
  7.             foreach (char c in Input)
  8.             {
  9.                 if (c == '\r' || c == '\n' || c == ' ')
  10.                 {
  11.                     string Word = builder.ToString();
  12.                     if (Word.Length > 0)
  13.                     {
  14.                         Output.Add(Word);
  15.                         if (Word.Length > *MaximumLength)
  16.                             *MaximumLength = Word.Length;
  17.                     }
  18.                     builder.Clear();
  19.                 }
  20.                 else if (c >= 'A' && c <= 'Z' || c == 'Ä' || c == 'Ö' || c == 'Å')
  21.                 {
  22.                     builder.Append((char)(c + 32));
  23.                 }
  24.                 else
  25.                 {
  26.                     builder.Append(c);
  27.                 }
  28.             }
  29.             return Output.ToArray();
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement