欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

中replace方法

方一強2年前20瀏覽0評論

中replace方法?

C#中的Replace函數(shù)返回的是替換后的新的字符串,所以還需要在賦值一次。

String s="abcd";

s= s.Replace("a","e");

這樣就可以了,先搞清楚daoreplace的用法,明白參數(shù)的順序

using System;

publicclass ReplaceTest {

publicstaticvoid Main() {

string errString = "This docment uses 3 other docments to docment the docmentation";

Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString);

// Correct the spelling of "document".

string correctString = errString.Replace("docment", "document");

Console.WriteLine("After correcting the string, the result is:{0}'{1}'",

Environment.NewLine, correctString);

}

}

//

// This code example produces the following output:

//

// The original string is:

// 'This docment uses 3 other docments to docment the docmentation'

//

// After correcting the string, the result is:

// 'This document uses 3 other documents to document the documentation'

java string 替換,中replace方法