
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Extract the string after the first space
Hello,
I can't find a java method that allows me to extract the whole string after the first space. For example, I have strings :
- word1 word2 word3
or
- word1 word 2
I want to have
- word2 word3
or
- word2
Thank you
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I finally used your solution with tMap because I'm not sure if it works with tWarn. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try this
row1.name.contains(" ")?row1.name.substring(row1.indexOf(" ")+1):""
// this expression is used to check if the string contains blank space? if yes, extract the whole string after the first space, if no, return an empty string.
Regards
Shong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help @Shicong Hong, it will be useful if I encounter this case in a tMap.
But I forgot to mention that I am looking to do this in a tWarn! In the context of a joblet, I use a context variable where the first word is always the same, but depending on the job, the second word varies.
I tried that, but without success

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I finally used your solution with tMap because I'm not sure if it works with tWarn. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would use regex expressions to do that. There is a component tExtractRegexFields to handle regex.
