How does one format the following:
From this:
1: My street
2: 1232321
3: Hello there world!
4: A really really really long word!
To this:
1: My street
2: 1232321
3: Hello there world!
4: A really really really long word!
I think it has something to do with String.format() and a bunch of random chars in it!
You can first split your string to get
1:andMy Streetseparately, and then format them: –Output : –
You can do this with
String#substringmethod also, to get the two parts separately.