Splitting Strings
If you want to split a string into multiples strings, you can use the Split method. Let’s take a look at the different overloads of the Splitmethod. The Split method returns a string array that…
Trimming Strings
Sometimes, a user types unnecessary spaces that may cause certain errors. When accepting strings from a user, especially if the input came from a text box or similar controls, have…
Concatenating Strings
There are several ways of concatenating strings. Concatenating simply means combining multiple strings into one. In C#, the simplest way to concatenate strings is by using the + operator as shown below.…
Comparing Strings
We can compare two strings for equality using several ways. For example, we can use the == operator to test if the two strings are equal. The == operator doesn’t compare their references, but…
Strings and Regular Expressions
String is the most common data type found in almost any programming languages. A string is a group of characters such as letters, numbers or symbols. It is declared using…
Random Number Generation
We use the ;class to generate random numbers. The Random class provides a method for generating random numbers. Each number has an equal chance of getting picked. We use the Next method to…
System.Math Class
You can use the ;class to perform certain mathematical calculations. You can use its method to round numbers, get the square root of a certain number, or determine the result of…
Date Difference Calculator
This tutorial guides you through the creation of a Time Difference Calculator which determines the difference of two given dates and returns the result in days. The program uses the ;and ;methods.…
System.DateTime Class
The class of the .NET Framework allows you to use, store, and manipulate data of time and date. It has methods for manipulation of dates such as adding or subtracting…