title: How to loop through a array in beanshell script in jmeter 3.2
body: <p>Is it possible to loop through a array and select a character from the <code>passwd</code> using the <code>ord[i]</code> value? Code</p>
  
  <pre><code>             String ordinal = vars.get("ordinal");
               String[] ord = ordinal.split(",");
               log.info(ord[0]);
  
               String passwd = vars.get("password");
               requiredOrd = new ArrayList();
               for(int i=0; i&lt; ord.length; i++)
               {
  
                      requiredOrd.add((passwd.charAt(ord[i])));
  
                }
  
            log.info(requiredOrd[0]); 
  </code></pre>
  
  <p>Returns error message as follows:</p>
  
  <p>2017-10-23 10:23:26,270 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: <code>String ordinal = vars.get("ordinal"); String[] ord = ordinal.split(","); log.inf . . . '' : Error in method invocation: Method charAt( java.lang.String ) not found in class'java.lang.String'
  2017-10-23 10:23:26,270 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval  Sourced file: inline evaluation of:</code>String ordinal = vars.get("ordinal"); String[] ord = ordinal.split(","); log.inf . . . '' : Error in method invocation: Method charAt( java.lang.String ) not found in class'java.lang.String'</p>