×

Loading...

Java TEST!!

Write a program that takes a single string as input, and outputs a list of strings it has split the input string into.


The delimiter for splitting the input string is the special "|" character. If you want a "|" character to appear within an output string and not be interpreted as a splitting character, then it must be preceded by the escape character "\". Any character followed by the "\" character will be interpreted literally, and not treated as a special character. In this case, the "\" escape character is thrown away, and the character following it is appended literally to the current output string. So for example, "a|b" would be split as "a", "b" but "a\|b" would not be split and would appear in the output as a single string "a|b".

For example, the following input string


"abc|def|gh\|ij\\kl\m"

would be split as follows


"abc", "def", "gh|ij\klm"
Report

Replies, comments and Discussions: