", slice) lt find("<", slice)> ---> asArray = ListToArray(arguments.lst, arguments.delim); for (i = 1; i LTE ArrayLen(asArray); i = i + 1) set[asArray[i]] = ""; if ((arguments.size gte 1024) and (arguments.size lt 1048576)) { return round(arguments.size / 1024) & "Kb"; } else if (arguments.size gte 1048576) { return decimalFormat(arguments.size/1048576) & "Mb"; } else { return "#arguments.size# b"; } ]*>", "", "ALL")> // Define the local scope. var LOCAL = StructNew(); // Check to see if we are using a string replace or a method // helper replace. if (IsSimpleValue( ARGUMENTS.Target )){ // We are doing a standard string replace, so just // use Java's string replacement. Check the scope. if (NOT Compare( ARGUMENTS.Scope, "ALL" )){ // Replace all. return( CreateObject( "java", "java.lang.String" ).Init( ARGUMENTS.Text ).ReplaceAll( ARGUMENTS.Pattern, ARGUMENTS.Target ) ); } else { // Replace one. return( CreateObject( "java", "java.lang.String" ).Init( ARGUMENTS.Text ).ReplaceFirst( ARGUMENTS.Pattern, ARGUMENTS.Target ) ); } } else { // We are using a function here to replace out the // groups. That means that matches have to be // evaluated and replaced on an individual basis. // Create the java pattern complied to the given regular // expression. if (IsSimpleValue(ARGUMENTS.Pattern)) { LOCAL.Pattern = CreateObject( "java", "java.util.regex.Pattern" ).Compile( ARGUMENTS.Pattern ); } else { // used the passed in Pattern object LOCAL.Pattern=ARGUMENTS.Pattern; } // Create the java matcher based on the given text using the // compiled regular expression. LOCAL.Matcher = LOCAL.Pattern.Matcher( ARGUMENTS.Text ); // Create a string buffer to hold the results. LOCAL.Results = CreateObject( "java", "java.lang.StringBuffer" ).Init(); // Loop over the matcher while we still have matches. while ( LOCAL.Matcher.Find() ){ // We are going to build an array of matches. LOCAL.Groups = ArrayNew( 1 ); for ( LOCAL.GroupIndex = 1 ; LOCAL.GroupIndex LTE LOCAL.Matcher.GroupCount() ; LOCAL.GroupIndex = (LOCAL.GroupIndex + 1) ){ // Add the current group to the array of groups. ArrayAppend( LOCAL.Groups, LOCAL.Matcher.Group( JavaCast( "int", LOCAL.GroupIndex ) ) ); } // Replace the current match. Be sure to get the value by // using the helper function. LOCAL.Matcher.AppendReplacement( LOCAL.Results, // Call the target function pointer using function notation. ARGUMENTS.Target( LOCAL.Matcher.Group(), LOCAL.Groups ) ); // Check to see if we need to break out of this. if (NOT Compare( ARGUMENTS.Scope, "ONE" )){ break; } } // Add what ever is left of the text. LOCAL.Matcher.AppendTail( LOCAL.Results ); // Return the string buffer. return( LOCAL.Results.ToString() ); } #header#">