Question

I have to drop out the first line (UNA:+.? ') from the following input string:

UNA:+.? '
UNB+UNOA:2+422207530:9+8713381197918:14+20141212:1555+1082746344'
UNH+1+ORDERS:D:97A:UN'
BGM+220+105961-44+9'
DTM+137:20140121:102'
NAD+BY+0048003479::91'
NAD+SE+0000805406::91'
NAD+DP+0048003479::91'
CUX+2:USD+9'
PIA+1+M1PL05883LOT:BP::92'
PIA+1+927700077001:VP::91'
PRI+AAA:9:::1:PCE'
SCC+1'
QTY+21:10000:PCE'
DTM+2:11022014:102'
PIA+1+M1PL05883LOT:BP::92'
PIA+1+927700080201:VP::91'
PRI+AAA:9:::1:PCE'
SCC+1'
QTY+21:20000:PCE'
DTM+2:04022014:102'
UNS+S'
UNT++1'
UNZ+1+10596144'
Was it helpful?

Solution

@Jerry has the right answer...

Assuming your string is in a variable input, you can do:

String output = input.split('\n') // Split into an array based on newline
                     .drop(1)     // Drop the first element
                     .join('\n')  // Join back into a string separated by newline
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top