Advertisement
StoyanGrigorov

TagTansformer

Mar 9th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PhotographersDB
  8. {
  9.     public class TagTansformer
  10.     {
  11.         public static string Transform(string tagString)
  12.         {
  13.             if (!tagString.StartsWith("#"))
  14.             {
  15.                 tagString += "#" + tagString;
  16.             }
  17.             if (tagString.Contains(" ") || tagString.Contains("\t"))
  18.             {
  19.                 tagString = tagString.Replace(" ", string.Empty);
  20.                 tagString = tagString.Replace("\t", string.Empty);
  21.             }
  22.             if (tagString.Length > 20)
  23.             {
  24.                 tagString = tagString.Substring(0, 20);
  25.             }
  26.  
  27.             return tagString;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement