How to substring out a value after a word/value

0

I have a descrption field from a table that contains the word/value Offset.  After Offset is a 2 char value that I need to extract for priting on my iReport.

Here is my feild data:   WD2.FD906: Offset  SQ. 1 X 3-1/16 L:0 B:1-7/8 & SQ. 1-9/16 X 4-5/16 L:3/8 B:0 - Flex

The value I need to extract is the SQ.  This value is not in the same position, it could be in a position less or more than it shows here, BUT it is always after the value Offset.

 

jrubino's picture
Joined: Oct 24 2018 - 6:47am
Last seen: 20 hours 10 min ago

1 Answer:

0

Hi,

If your field is java.lang.String type use $F{field}.substring(startIndex, endIndex)

Otherwise, use $F{field}.toString().substring(startIndex, endIndex)

In usecase from question it will be:

$F{field}.substring(18, 21)

akovach's picture
249
Joined: Apr 25 2018 - 2:25am
Last seen: 1 hour 56 min ago
Feedback