Esempio n. 1
0
 public static string Concatenate(string target, DictionaryBonsaiFunction scope, object[] args)
 {
     StringBuilder sb = new StringBuilder(target, target.Length + 10);
     foreach (var arg in args)
         if (arg != null)
             sb.Append(arg.ToString());
     return sb.ToString();
 }
Esempio n. 2
0
        public static decimal Substract(decimal target, DictionaryBonsaiFunction scope, object[] args)
        {
            decimal result = target;
            foreach (IConvertible o in args) {
                result -= o.ToDecimal(CultureInfo.InvariantCulture);
            }

            return result;
        }
Esempio n. 3
0
 public static decimal Round(decimal target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 0);
     return Math.Round(target);
 }
Esempio n. 4
0
 public static decimal Power(decimal target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 1 && args[0] is decimal);
     return (decimal)Math.Pow((double)target, (double)(decimal)args[0]);
 }
Esempio n. 5
0
 public static decimal Modulo(decimal target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 1 && args[0] is decimal);
     return (decimal)(target % (decimal)args[0]);
 }
Esempio n. 6
0
 public static decimal Floor(decimal target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 1 && args[0] is decimal);
     return Math.Floor(target);
 }
Esempio n. 7
0
 public static string Upcase(string target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 0);
     return target.ToUpperInvariant();
 }
Esempio n. 8
0
 public static bool Contains(string target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 1 && args[0] is IConvertible);
     return target.Contains(((IConvertible)args[0]).ToString());
 }
Esempio n. 9
0
 public static string Capitalize(string target, DictionaryBonsaiFunction scope, object[] args)
 {
     Debug.Assert(args.Length == 0);
     return Regex.Replace(target, @"\b\w", new MatchEvaluator(m => m.Value.ToUpperInvariant()));
 }