1. 程式人生 > >C#常用方法使用分享

C#常用方法使用分享

post left p s body log pos 常用方法 contain gpo

<一>

方法:Split

描述:分割函數

內容: string str="2017-12-21"

取值: str.Split(‘-‘)[0] :2017

    str.Split(‘-‘)[2] :21

<二>

  方法: Contains

  描述:檢某個字符在當前字符串中是否存在

  內容: string str="2017-12-21"

取值:if (str.Contains("12"))

{
存在則 str.Split(‘-‘)[1] :12
}

C#常用方法使用分享