001 /** 002 * Implements the CFML Function findoneof 003 */ 004 package railo.runtime.functions.string; 005 006 import railo.runtime.PageContext; 007 import railo.runtime.ext.function.Function; 008 009 public final class FindOneOf implements Function { 010 public static double call(PageContext pc , String set, String str) { 011 return call(pc,set,str,1); 012 } 013 public static double call(PageContext pc , String strSet, String strData, double number) { 014 // strData 015 char[] data=strData.toCharArray(); 016 // set 017 char[] set=strSet.toCharArray(); 018 // start 019 int start=(int)number-1; 020 if(start<0)start=0; 021 022 if( start>=data.length || set.length==0) return 0; 023 //else { 024 for(int i=start;i<data.length;i++) { 025 for(int y=0;y<set.length;y++) { 026 if(data[i]==set[y])return i+1; 027 } 028 } 029 //} 030 return 0; 031 } 032 033 }