I have array of String like mentioned in code below. I am eliminating double quote present in each element but I have to perform an additional operation on last Index as I know that there is additional double quote.
String array[] = new String[]{"\"Awesome Systems, Inc. - 357", "\"Awesome Systems, Inc - 357", "\"wpe_stage\""};
Arrays.stream(array).map((str) -> (str = str.trim())
.substring(1, str.length()))
.forEach(System.out::println);
What I am getting is an output like-
Awesome Systems, Inc. - 357
Awesome Systems, Inc - 357
wpe_stage"
The desired output is like-
Awesome Systems, Inc. - 357
Awesome Systems, Inc - 357
wpe_stage
How can I do this using stream functionality or lambda? Is there any way to select last index in stream or any filtering based on index is possible?