<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: substring method in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319611#M89836</link>
    <description>&lt;P&gt;Thanks @Aiming Chen​&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2022 10:49:38 GMT</pubDate>
    <dc:creator>lmit</dc:creator>
    <dc:date>2022-08-29T10:49:38Z</dc:date>
    <item>
      <title>substring method</title>
      <link>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319608#M89833</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Am trying to extract substring from a string like Adult (18-60 years)&lt;/P&gt;&lt;P&gt;i should get the output as Adult from the above string&lt;/P&gt;&lt;P&gt;I used method &lt;/P&gt;&lt;P&gt;column_name == null || column_name == ""?&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;column_name..substring(column_name.lastIndexOf(" ")+1)&lt;/P&gt;&lt;P&gt; but am getting below error&lt;/P&gt;&lt;P&gt;java.lang.StringIndexOutOfBoundsException: String index out of range: -1&lt;/P&gt;&lt;P&gt;Can someone please suggest what wrong am doing &lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;lmit&lt;/P&gt;</description>
      <pubDate>Sat, 27 Aug 2022 17:17:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319608#M89833</guid>
      <dc:creator>lmit</dc:creator>
      <dc:date>2022-08-27T17:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: substring method</title>
      <link>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319609#M89834</link>
      <description>&lt;P&gt;Hello lmit,&lt;/P&gt;&lt;P&gt;To get the Adult from the above string, you can try:&lt;/P&gt;&lt;P&gt;column_name.substring(0,5)&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;column_name.split(" ")[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Aiming&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 01:07:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319609#M89834</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-29T01:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: substring method</title>
      <link>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319610#M89835</link>
      <description>&lt;P&gt;Hello lmit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please do not use == operator to compare Strings in Java, use &lt;/P&gt;&lt;P&gt;column_name.equals("")&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;column_name.isEmpty()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does your input data contain Strings without a blank? Perhaps the IndexOutOfBounds-Exception occurs in those cases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your example input "Adult (18-60 years)", the substring- and &lt;B&gt;last&lt;/B&gt;IndexOf-Methods would yield "years)", because the substring starts at the last blank (+1) in the string and extends to the end. May I suggest&lt;/P&gt;&lt;P&gt;column_name.substring(0, column_name.indexOf(" ") -1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 09:52:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319610#M89835</guid>
      <dc:creator>ThWabi</dc:creator>
      <dc:date>2022-08-29T09:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: substring method</title>
      <link>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319611#M89836</link>
      <description>&lt;P&gt;Thanks @Aiming Chen​&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 10:49:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/substring-method/m-p/2319611#M89836</guid>
      <dc:creator>lmit</dc:creator>
      <dc:date>2022-08-29T10:49:38Z</dc:date>
    </item>
  </channel>
</rss>

