-4

In C# this would work - String[] elements = sample.Split((char)30);

What is the java equivalent?

1

1 Answer 1

5

String.split() takes a regex string. For your purpose, you just need to convert the char to a String:

String[] elements = sample.split(Character.toString((char)30)); 
Sign up to request clarification or add additional context in comments.

2 Comments

Or sample.split("\u001E").
Thanks for helping me understand !!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.