|
using System;
using System.Collections.Generic;
using System.Text;
namespace Zadesoft.Library.Script.Functions
{
public class DoesContainWordFunction
: IFunction
{
#region IExternalFunctionExecutor Members
public string Name
{
get { return "DoesContainWord"; }
}
public Type ReturnType
{
get { return typeof(bool); }
}
public object Execute(params object[] paras)
{
if (paras == null || paras.Length < 2 || paras[0] == null || paras[1] == null)
{
throw new ArgumentException("lack parameters or bad parameters");
}
if (paras[0] is string && paras[1] is string)
{
return ((string)paras[0]).IndexOf((string)paras[1]) > -1;
}
else
{
throw new ArgumentException("parameters' data type is not matched");
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Just develop simple softwares. C# is my favorite prgramming languare, though I hope to create a new one...