原书 P120 代码 1
string name = "Jennifer Ingram";
原书 P120 代码 2
string name = "Mike McMillanInstructor, CIS Room 306";
原书 P121 代码
using System;
class Chapter7
{
static void Main()
{
string string1 = "Hello, world!";
int len = string1.Length;
int pos = string1.IndexOf(" ");
string firstWord, secondWord;
firstWord = string1.Substring(0, pos);
secondWord = string1.Substring(pos + 1,(len - 1) - (pos + 1));
Console.WriteLine("First word: " + firstWord);
Console.WriteLine("Second word: " + secondWord);
Console.Read();
}
}
原书 P122 代码
string s = "Now is the time";
string sub = s.Substring(0, 3);
原书 P123 代码 1
using System;
using System.Collections;
class Chapter7
{
static void Main()
{
- 1
- 2
- 3
- 4
- 5
- 6
前往页