String can be split into collection of substrings based on a defined character (separator) using Split() function. Split is part of String class which exists in the System namespace.
Split function is overloaded and has various forms which allow to:
Continue reading C# – How to split a string
- pass separator as a single character, array of characters, single string or array of strings;
- define maximum number of substrings in output array;
- define split options like removing empty elements from returned collection.
There are three easiest ways which allow you to convert string data type to int:
- Parse method
- TryParse method
- Convert class
In the following article I’ll explain each one and show the example of its usage.
Continue reading C# – How to convert string to int
There are plenty of methods to achieve this but even though it’s simple task you need to specify requirements like:
- are white spaces allowed?
- how to treat empty string?
- what’s the maximum length of the string?
In this article I want to describe 3 different ideas how to solve this problem.
Continue reading C# – How to check if string contains only digits