开发者

how to substring from a string using c#

开发者 https://www.devze.com 2022-12-15 18:42 出处:网络
The following is a line ofhuge .txt file and i am reading it line by line. I need the value of second column.In this line, I need to extract \'C9006\'.

The following is a line of huge .txt file and i am reading it line by line. I need the value of second column. In this line, I need to extract 'C9006'.

Mr ABC|C9006|The white field, ON|493-493-4939|493-493-4939|YR|Inactive

No开发者_开发知识库te : The delimiter char is pipe sign '|'. The length of second column is not consistent.

Help please.


String value = "A|B|C";
String secondColumn = value.split("|")[1];


You can use the Split method of String.


string result = input.Split('|')[1];
0

精彩评论

暂无评论...
验证码 换一张
取 消