<?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: extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15 in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325246#M94862</link>
    <description>&lt;P&gt;Something like this should work.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(row3.street!=&lt;B&gt;null&lt;/B&gt;&amp;amp;&amp;amp;row3.street.trim().equals("")==&lt;B&gt;false&lt;/B&gt;) ? row3.street.indexOf('-')&amp;gt;-1 ? row3.street.substring(row3.street.indexOf('-')+1) : row3.street.indexOf(' ')&amp;gt;-1 ? row3.street.substring(row3.street.indexOf(' ')+1) : row3.street : row3.street&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 13:57:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-10-11T13:57:20Z</dc:date>
    <item>
      <title>extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15</title>
      <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325243#M94859</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to extract all characters of a string before a certain character (eg. "-" or " ").&lt;/P&gt;&lt;P&gt;I used tJavaRow for this with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((row3.street== null) || ("".equals(row3.street )) || row3.street.isEmpty() &amp;amp;&amp;amp; ((String)input_row.street).contains("-"))&lt;/P&gt;&lt;P&gt;output_row.street = StringHandling.LEFT(input_row.street,StringHandling.INDEX(input_row.street,"("));&lt;/P&gt;&lt;P&gt;else if((input_row.street) != null &amp;amp;&amp;amp; !((String)input_row.street).contains("("))&lt;/P&gt;&lt;P&gt;output_row.street = input_row.street;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I keep getting this out of bounds for lengths error and could t find a fix. Could you help me out here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exception in component tJavaRow_1 (Extract_Country_Code)&lt;/P&gt;&lt;P&gt;java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)&lt;/P&gt;&lt;P&gt;	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)&lt;/P&gt;&lt;P&gt;	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4589)&lt;/P&gt;&lt;P&gt;	at java.base/java.lang.String.substring(String.java:2703)&lt;/P&gt;&lt;P&gt;	at routines.StringHandling.LEFT(StringHandling.java:229)&lt;/P&gt;&lt;P&gt;	&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 22:30:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325243#M94859</guid>
      <dc:creator>Moro</dc:creator>
      <dc:date>2024-11-15T22:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15</title>
      <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325244#M94860</link>
      <description>&lt;P&gt;I think this is what you need.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(row3.street!=&lt;B&gt;null&lt;/B&gt;&amp;amp;&amp;amp;row3.street.trim().equals("")==&lt;B&gt;false&lt;/B&gt;) ? row3.street.indexOf('-')&amp;gt;-1 ? row3.street.substring(0,row3.street.indexOf('-')) :  row3.street.indexOf(' ')&amp;gt;-1 ? row3.street.substring(0, row3.street.indexOf(' ')) : row3.street : row3.street&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 20:43:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325244#M94860</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-04T20:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15</title>
      <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325245#M94861</link>
      <description>&lt;P&gt;Hi Shall,&lt;/P&gt;&lt;P&gt;thank you very much. This works. &lt;/P&gt;&lt;P&gt;I would like to get the characters after the " " or "-". How to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 12:30:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325245#M94861</guid>
      <dc:creator>Moro</dc:creator>
      <dc:date>2022-10-11T12:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15</title>
      <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325246#M94862</link>
      <description>&lt;P&gt;Something like this should work.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(row3.street!=&lt;B&gt;null&lt;/B&gt;&amp;amp;&amp;amp;row3.street.trim().equals("")==&lt;B&gt;false&lt;/B&gt;) ? row3.street.indexOf('-')&amp;gt;-1 ? row3.street.substring(row3.street.indexOf('-')+1) : row3.street.indexOf(' ')&amp;gt;-1 ? row3.street.substring(row3.street.indexOf(' ')+1) : row3.street : row3.street&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 13:57:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325246#M94862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-11T13:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: extracting string before certain character - error: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 15</title>
      <link>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325247#M94863</link>
      <description>&lt;P&gt;Thank you very much rhall! It works and understand it now. Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 09:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/extracting-string-before-certain-character-error-java-lang/m-p/2325247#M94863</guid>
      <dc:creator>Moro</dc:creator>
      <dc:date>2022-10-12T09:28:44Z</dc:date>
    </item>
  </channel>
</rss>

