0

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

Note : The delimiter char is pipe sign '|'. The length of second column is not consistent.

Help please.

3 Answers 3

3
String value = "A|B|C";
String secondColumn = value.split("|")[1];
Sign up to request clarification or add additional context in comments.

Comments

1

You can use the Split method of String.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.