<?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 String index out of range error in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/String-index-out-of-range-error/m-p/2211882#M9727</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am trying to read data from xml file and write them to Mysql db. In my db House_no field's data type is String(40). In xml file there are some house no values that longer than 40 and i want to cut all the values that are greater than 40.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so i try the code below in tMap but i got "java.lang.StringIndexOutOfBoundsException: String index out of range: 40 at java.lang.String.substring(Unknown Source)" error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;row4.house_no.length()&amp;gt;40 ?"" : row4.house_no.substring(0,40)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have any idea what cause this error, or a better way to take 0-40 character without using tJavaRow.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;iosman&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;___________________________&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://solutionforwindows.com/0xc000000f" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;0xc000000f&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 04:52:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T04:52:06Z</dc:date>
    <item>
      <title>String index out of range error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-index-out-of-range-error/m-p/2211882#M9727</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am trying to read data from xml file and write them to Mysql db. In my db House_no field's data type is String(40). In xml file there are some house no values that longer than 40 and i want to cut all the values that are greater than 40.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so i try the code below in tMap but i got "java.lang.StringIndexOutOfBoundsException: String index out of range: 40 at java.lang.String.substring(Unknown Source)" error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;row4.house_no.length()&amp;gt;40 ?"" : row4.house_no.substring(0,40)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have any idea what cause this error, or a better way to take 0-40 character without using tJavaRow.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;iosman&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;___________________________&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://solutionforwindows.com/0xc000000f" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;0xc000000f&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:52:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-index-out-of-range-error/m-p/2211882#M9727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T04:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: String index out of range error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-index-out-of-range-error/m-p/2211883#M9728</link>
      <description>&lt;P&gt;Try putting you ternary statement in the correct order and add a "null" check to it:&lt;/P&gt;&lt;PRE&gt;row4.house_no != null &amp;amp;&amp;amp; row4.house_no.length() &amp;gt; 40 ? row4.house_no.substring(0,40) : row4.house_no&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Aug 2019 16:48:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-index-out-of-range-error/m-p/2211883#M9728</guid>
      <dc:creator>JR1</dc:creator>
      <dc:date>2019-08-24T16:48:43Z</dc:date>
    </item>
  </channel>
</rss>

