I am using a List<String[]>
with a few smaller case fields.
List<String[]> csvBody = reader.readAll();
My output should be of the same datatype List<String[]>
.
Is there a possibility to convert every String in my Container to uppercase in a stretch?
I reckon you can use a combination of List#replaceAll
and a Stream
to map the arrays:
csvBody.replaceAll(a -> Arrays.stream(a)
.map(String::toUpperCase)
.toArray(String[]::new));
Just iterate the strings:
List<String[]> csvBody = reader.readAll();
for (String[] strings : csvBody) {
for (int i = 0; i < strings.length; i++) {
strings[i] = strings[i].toUpperCase();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With