
Creator
‎2017-03-21
04:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[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?
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?
656 Views
1 Solution
Accepted Solutions

Specialist
‎2017-03-21
06:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 "="?
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 "="?
656 Views
2 Replies

Specialist
‎2017-03-21
06:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 "="?
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 "="?
657 Views

Creator
‎2017-03-27
12:16 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
The thing is that I didn't expect them in the output but I guess that is what happens sometimes! haha
Thanks,
Croix
656 Views
