Java Scanner - next String until a | is found

Posted by user1375883 on Stack Overflow See other posts from Stack Overflow or by user1375883
Published on 2012-10-20T04:52:27Z Indexed on 2012/10/20 5:01 UTC
Read the original article Hit count: 129

Filed under:
|

Currently I'm trying to read through some basic cells, in this format:

+-------+-------+
|       |       |
+-------+-------+

Now I need to get the string representation of the cell's contents and send it off to another method. The problem is that the cells have no pre-defined length. I'm reading these from a file, so my easiest option should be to just use the Scanner I already have set up. Problem is, I don't really know how for this case.

I have a strong feeling that I need to use the pattern somehow, but I'm at a complete loss on how to do it.

I could also probably just build it up somehow, but that strikes me as being painfully slow.

© Stack Overflow or respective owner

Related posts about java

Related posts about java-util-scanner