private static SplitWithString ( String thisob, |
||
thisob | String | |
engine | ||
separator | String | |
limit | uint | |
return |
public static ArrayObject split(Object thisob, VsaEngine engine, Object separator, Object limit) { String thisStr = Convert.ToString(thisob); uint limitValue = UInt32.MaxValue; if (limit != null && !(limit is Missing) && limit != DBNull.Value) { double lmt = Convert.ToInteger(limit); if (lmt >= 0 && lmt < UInt32.MaxValue) { limitValue = (uint)lmt; } } if (limitValue == 0) { return((ArrayObject)engine.GetOriginalArrayConstructor().Construct()); } if (separator == null || separator is Missing) { ArrayObject array = (ArrayObject)engine.GetOriginalArrayConstructor().Construct(); array.SetValueAtIndex(0, thisob); return(array); } RegExpObject regExpObject = separator as RegExpObject; if (regExpObject != null) { return(StringPrototype.SplitWithRegExp(thisStr, engine, regExpObject, limitValue)); } Regex regex = separator as Regex; if (regex != null) { return(StringPrototype.SplitWithRegExp(thisStr, engine, new RegExpObject(regex), limitValue)); } return(StringPrototype.SplitWithString(thisStr, engine, Convert.ToString(separator), limitValue)); }