cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting string

Former Member
0 Kudos

I have one String "S" size 0 to 200 in Source.

I need to map S to 3 fields in Target. I used substring ,When the size become less than 200 ,it is giving Outofbounds Exception.

-


S1(0,60)

S(0,200) -


S2(0,60)

-


S3(0,60)

Can anyone help me on this?

Which is better eithr GUI Mapping or Java Mapping?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

helpful

former_member189441
Active Participant
0 Kudos

hi,

before mapping the source field to target structure first you can check wheather that string has length less than the specified length that you want by writing UDF and then map it to target field.

Edited by: murali krishna on Sep 1, 2008 5:56 PM

former_member189441
Active Participant
0 Kudos

hi,

you can do padding with some null characters before giving the string to substring function.That means if the length of the string is 200, but if only 150 characters are coming from source field then fill the remining 50 chracters with null values by using UDF,then you can give the new padded string to the substring function.

Former Member
0 Kudos

Hi,

using a UDF instead of the standard substring function.

There you have to catch the IndexEutofboudnException e.g. if there are less than 200 characters use 0 till string.length-1

In standard this exception is not catched

Kind regards

Jochen

Former Member
0 Kudos

Hi,

you get a OutOfBoundexception because the string does not have the length that you expect in your substring statements.

Regards Mario

Former Member
0 Kudos

I know..that ,but how to resolve...any idea?