<div dir="ltr"><div><div>This would require 'recursive' searching.... letter-by-letter<br><br></div><div>ABAABA , ..... NC=7 (# characters)<br>0123456<br></div><div><br></div><div>[0[ set 'idx=0'<br></div><div>[1] Find 'ABA', success; IDX = 0<br></div><div>[2] set 'idx=1', and search the string BAABA<br></div><div>[3] Find 'ABA', success, set IDX = (/0,4/)<br></div><div>[4] set idx=5<br></div><div>[5] repeat .... ad infinitum <br><br></div><div>I think you could write a function that does that. <br><br></div><div>undef("get_many_index_str")<br></div><div>function get_many_index_str(str:string)<br></div><div>begin<br> ...<br></div><div> return(IDX)<br></div><div>end<br></div><div><br></div><div>Why does NCL not do that? Well, let's say NC=1000000<br></div><div>This would be VERY time consuming.</div></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 9, 2016 at 2:31 PM, Yuqiang Zhang <span dir="ltr"><<a href="mailto:yuqiangzhang.thu@gmail.com" target="_blank">yuqiangzhang.thu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Dear NCL developers, <div><br></div><div>I was using the "str_index_of_substr" to find the sub array recently, and found some interesting thing about it. </div><div><br></div><div>For example, </div><div><br></div><div>a = "ABABA"</div><div>substr = "ABA"</div><div><br></div><div>i1 = str_index_of_substr(a, substr, 0)</div><div>print(i1)</div><div><br></div><div>The output is 0, which is "<b>ABA</b>BA" only, but actually I kind hope it could find both "<b>ABA</b>BA" and "AB<b>ABA</b>". Any way to bypass that?</div><div><br></div><div>Thanks! </div><div>Regards,</div><div>Yuqiang</div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>