BorislavBorisov

! От string през чар ch - '0' в int

Sep 27th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.22 KB | None | 0 0
  1. using System;
  2. class StringToCharToInt
  3. {
  4.     static void Main()
  5.     {
  6.         string a = "1234";
  7.         char ch = a.ToString()[3];        
  8.         int number = ch - '0';
  9.         Console.WriteLine(number);// 4
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment