
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Splitting of String in Talend
Hi All ,
I need a small help . I have an input ,e.g : ABC : 123 which is completely in string as it is a file . The length of this input may vary or i can say is dynamic. I need to extract only the right hand part from based on the delimiter which is ": " and whatever comes after the delimiter i need to store. The input that comes before the delimiter needs to be excluded . Can you please help me ? I tried substring and lastIndexOf but this seems useful when you have fixed length,i donot have fixed length input . It can be of any length. if anyone can please suggest some java code it will be great. textractdelimitedfield would not help in my scenario.Only tmap or javacode would .
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Along the same lines as what Ansel suggested, assuming your string was in Notes, you might try the following:
StringHandling.RIGHT(row10.Notes,((int)StringHandling.LEN(row10.Notes))-((int)row10.Notes.indexOf(":"))-1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use a tNormalize component and put ":" as your delimiteur

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No ,I have already tried it ,doesnt help. I would rather require a regex or a routine

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Riya P
Supposing this String is in a column called "content" coming from a input called row1, what if you try the following:
row1.content.substring(row1.content.indexOf(":"))
The indexOf method returns the index of the first occurrence of ":" inside the source String and passes this index to the substring method, which you get all the String content after ":"
You can add +1 to this index to exclude the ":" from the result:
row1.content.substring(row1.content.indexOf(":")+1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey hi, thanks for suggesting this way. I tried it but it's storing the 1st part of the string whereas I'm in need of the later

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Along the same lines as what Ansel suggested, assuming your string was in Notes, you might try the following:
StringHandling.RIGHT(row10.Notes,((int)StringHandling.LEN(row10.Notes))-((int)row10.Notes.indexOf(":"))-1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Works 🙂 Thanks !
