Advertisement
Guest User

Untitled

a guest
Nov 11th, 2011
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.  
  22.         }
  23.  
  24.         public static string code(string numeroUtilisateur)
  25.         {
  26.             string str = "";
  27.             int num = 0;
  28.             for (int i = 0; i < numeroUtilisateur.Length; i++)
  29.             {
  30.                 if (numeroUtilisateur[i] != '-')
  31.                 {
  32.                     str = str + "BCDFGHJKMPQRTVWXY2346789"[Convert.ToInt16((int)(numeroUtilisateur[i] + i)) % 0x17];
  33.                     num++;
  34.                     if ((num % 3) == 0)
  35.                     {
  36.                         str = str + "-";
  37.                     }
  38.                 }
  39.             }
  40.             if (str.LastIndexOf('-') == (str.Length - 1))
  41.             {
  42.                 str = str.Substring(0, str.Length - 1);
  43.             }
  44.             return str;
  45.         }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.     }
  52. }
  53.  
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement