Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. private string substitution(string inString)
  2. {
  3. string normalAlphabet = "abcdefghijklmnopqrstuvwxyz .!?,";
  4. string cipherAlphabet = "efg.hijk!lmn opqr?stuv,wxyzabcd";
  5. string cipheredText = "";
  6. inString = inString.ToLower();
  7. for (int index1 = 0; index1 < inString.Length; index1++)
  8. {
  9. for (int index2 = 0; index2 <= 30; index2++)
  10. {
  11. if (inString[index1] == normalAlphabet[index2])
  12. {
  13. cipheredText = cipheredText + cipherAlphabet[index2];
  14. }
  15. }
  16. }
  17. return cipheredText;
  18. }
  19.  
  20. private string transposition(string inString)
  21. {
  22. int myCounter = 0;
  23. string theFirstWord = "";
  24. string theLastWord = "";
  25. while (myCounter < inString.Length)
  26. {
  27. theFirstWord = theFirstWord + inString[myCounter];
  28. myCounter += 2;
  29. }
  30. for (myCounter = 1; myCounter < inString.Length; myCounter += 2)
  31. {
  32. theLastWord = theLastWord + inString[myCounter];
  33. }
  34. return (theFirstWord + " " + theLastWord);
  35. }
Add Comment
Please, Sign In to add comment