獲取給定字串的子字串

string helloWorld = "Hello World!";
string world = helloWorld.Substring(6); //world = "World!"
string hello = helloWorld.Substring(0,5); // hello = "Hello"

Substring 從給定索引或兩個索引(包括兩個索引)之間返回字串。