Issue with displaying text

Was wonder if any one else is having a issue with “Madrigal of Tampa is in excellent condition!” not showing up correctly like 95% of the time. Im sure its the ide but not 100% sure. Have tried intellij 2018.2.4 and 2018.3. When i run it i usually just get “is in excellent condition!”. Can only seem to get it display correctly if i run it as debug and it only works like 1 out of 10 times. I have looked into debugging it and i can see that Madrigal of Tampa is there when printplayerStatus is run. Any ideas?

1 Like

If you are using Windows not Mac OS,
the following code must be corrected in the Listing 13.10, 13.11, 13.12.

private fun selectHometown() = File(“data/towns.txt”)
.readText()
.split("\r\n") // for Windows, if Mac OS, \n instead of \r\n
.shuffled()
.first()

Good luck!

1 Like

or use platform independent from Java 7:
.split(System.lineSeparator())