Get substring from the middle in CSharp

Description

The following code shows how to get substring from the middle.

Example


using System; /*  w ww.  j a v a 2  s . com*/
 
public class SubStr {  
  public static void Main() {  
    string orgstr = "C# makes strings easy."; 
 
    // construct a substring 
    string substr = orgstr.Substring(5, 12); 
     
    Console.WriteLine("orgstr: " + orgstr); 
    Console.WriteLine("substr: " + substr); 
 
  }  
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var