Advertisement
Guest User

GetSFDCId

a guest
Mar 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1.  using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace sfchars {
  5.     class Program {
  6.         static void Main(string[] args) {
  7.                         string suffix = string.Empty;
  8.  
  9.                         for (int i = 0; i < 3; i++) {
  10.                                 int flags = 0;
  11.  
  12.                                 for (int f = 0; f < 5; f++) {
  13.                                         string c = (args[0][i*5+f]).ToString();
  14.                                         if (c.ToUpper() == c && Regex.IsMatch(c, @"[a-zA-Z]")) {
  15.                                                 flags = flags + (1 << f);
  16.                                         }
  17.                                 }
  18.  
  19.                                 if (flags <= 25) {
  20.                                         suffix = suffix + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[flags];
  21.                                 } else {
  22.                                         suffix = suffix + "012345"[flags - 26];
  23.                                 }
  24.                         }
  25.             Console.WriteLine(args[0] + suffix);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement