Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Croix
Creator

[resolved] How to Substring a Large String in tMap

Neither of these worked in tMap Expression Builder for strings larger than 46 characters. It seems that strings larger than 46 characters cannot be operated on. Is that correct?
This is what I'm trying to do. Through experimentation, it seems to throw errors once the "index" or "indexOf" is bigger than 46.
StringHandling.LEFT(row11.out,StringHandling.INDEX(row11.out,"=")) 
row11.out.substring(0, row11.out.indexOf("=")) 
For both I get a 
"String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1"
Does anyone know why it would do this? 
Labels (3)
1 Solution

Accepted Solutions
cterenzi
Specialist

Strings should not be constrained to 46 characters.  Is it possible your schema is defining that column of input with length 46?
StringHandling.INDEX will return -1 if either of its arguments are null.  Are there any cases where row11.out is null?
indexOf returns -1 if the searched for character is not found.  Are there any instancens where row11.out does not contain "="?

View solution in original post

2 Replies
cterenzi
Specialist

Strings should not be constrained to 46 characters.  Is it possible your schema is defining that column of input with length 46?
StringHandling.INDEX will return -1 if either of its arguments are null.  Are there any cases where row11.out is null?
indexOf returns -1 if the searched for character is not found.  Are there any instancens where row11.out does not contain "="?
Croix
Creator
Author

I think that, in the end, that some of the strings I had were null. 
The thing is that I didn't expect them in the output but I guess that is what happens sometimes! haha
Thanks,
Croix