#Need help printing a database off in main method not understanding

7 messages · Page 1 of 1 (latest)

lethal summitBOT
#

This post has been reserved for your question.

Hey @slate fulcrum! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

uncut edge
#

The typical solution would be to build your file differently, like your fields would be separated by something else but whitespace

#

But if you want it fragile and hacky, you could split on whitespace, check how many items you get, and from there deduce how many if them are part of the city name

normal mesa
#

The format is tab-separated, so "Salt Lake City" should still arrive as a single field because those words are being separated by spaces not tabs

#

./run java

var x = "one\tSalt Lake City\ttwo";
System.out.println(java.util.Arrays.asList(x.split("\t")));
raven muralBOT
#

Here is your java(15.0.2) output @normal mesa

[one, Salt Lake City, two]