Advertisement
yahorrr

Untitled

Oct 11th, 2022
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. private static void ThrowExceptionIfCurrencyIsNotValid(string currency)
  2.         {
  3.             if (currency.Length != 3)
  4.             {
  5.                 throw new ArgumentException(" ", nameof(currency));
  6.             }
  7.  
  8.             for (int i = 0; i < currency.Length; i++)
  9.             {
  10.                 if (!char.IsLetter(currency[i]))
  11.                 {
  12.                     throw new ArgumentException(" ", nameof(currency));
  13.                 }
  14.             }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement