Hi Gowri,
Java substring operations (which underpin webMethods String handlers) use zero-based counting and the “end” position you give is non-inclusive - that is, it is the location of the first character to NOT include in the substring extraction.
That means to extract the second character from a string, you would use a start position of 1 and an end position of 2 - this means everything from character position 1 up to and NOT INCLUDING character position 2.
e.g. webMethods - start location 3, end location 4 = “M”
This is why the start and end locations cannot be the same.
Page 56 of the Flat File Schema Developer’s Guide (FlatFileSchemaDevGuide.pdf) explains fixed-position extraction like this:
Fixed Position. Counting from zero (0), extracts a fixed number of characters from a
record.
! Start Position. First character to extract from the record.
! End Position. First character that is not included in the extraction. If you enter a
negative number (for example, -1), the extractor returns all characters from the
character specified in the Start Position to the last character in the record or
composite.
For example:
record = webMethods
Start Position = 1
End Position = 7
Extracted characters = ebMeth
Hope this helps.
Cheers,
Steve Ovens
webMethods Professional Services
Melbourne, Australia
#webMethods-General#webMethods#Integration-Server-and-ESB