编程语言
首页 > 编程语言> > C#l零基础学习传智播客(23)P112-P114-字符串,字符串的练习

C#l零基础学习传智播客(23)P112-P114-字符串,字符串的练习

作者:互联网

P112-面向对象的继承-06-字符串的方法(2)

字符串函数详解
字符串替换:string Replace(string oldValue, string newValue)将字符串中的出现oldValue的地方替换为newValue。例子:名字替换。
取子字符串:string Substring(int startIndex),取从位置startIndex开始一直到最后的子字符串;
string Substring(int startIndex, int length),取从位置startIndex开始长度为length的子字符串,如果子字符串的长度不足length则报错。
bool Contains(string value)判断字符串中是否含有子串value
bool StartsWith(string value)判断字符串是否以子串value开始;
bool EndsWith (string value)判断字符串是否以子串value结束;
int IndexOf(string value):取子串value第一次出现的位置。
Int IndexOf(string value,int startIndex)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks<

标签:P112,传智播,string,System,value,startIndex,字符串,using
来源: https://blog.csdn.net/weixin_43428283/article/details/110196196