ReplaceWithRegExp() private static method

private static ReplaceWithRegExp ( String thisob, RegExpObject regExpObject, Object replacement ) : String
thisob String
regExpObject RegExpObject
replacement Object
return String
示例#1
0
        public static String replace(Object thisob, Object regExp, Object replacement)
        {
            String       thisStr      = Convert.ToString(thisob);
            RegExpObject regExpObject = regExp as RegExpObject;

            if (regExpObject != null)
            {
                return(StringPrototype.ReplaceWithRegExp(thisStr, regExpObject, replacement));
            }
            Regex regex = regExp as Regex;

            if (regex != null)
            {
                return(StringPrototype.ReplaceWithRegExp(thisStr, new RegExpObject(regex), replacement));
            }
            return(StringPrototype.ReplaceWithString(thisStr, Convert.ToString(regExp), Convert.ToString(replacement)));
        }