I am using C # and I want to convert a string to int to check the name. For example, **or is 12not a name. I just want to convert the string to ASCII values ββand then check the name. How to do it?
**
12
Converting back and forth is simple:
int i = int.Parse("42"); string s = i.ToString();
If you do not know that the input line is valid, use the method int.TryParse().
int.TryParse()
, , ? , , , , , . , , :
public bool IsValidName(string theString) { for (int i = 0; i < theString.Length - 1; i++) { if (!char.IsLetter(theString[i]) && !char.IsWhiteSpace(theString[i])) { return false; } } return true; }
, , , , , . (, .)
, , ASCII :
System.Text.Encoding.ASCII.GetBytes(str)
Source: https://habr.com/ru/post/1751702/More articles:Is there a tac version that destroys content? (e.g. zcat) - bashCustomize content footer - cssWindsor Castle RemoveComponent False - dependency-injectionAudio programming and tone synthesis - androidNSApplicationDelegate is active due to URL protocol - objective-cChanging background when jQuery is stuck or if it is not possible to update the img src attribute - javascriptAndroid automatic circular gallery - androidCan I create materialized Oracle views for sqllink SQL Server table? - sqlHow to convert xml data to dataset - vb.netAfter dynamic counting - pythonAll Articles