コード例 #1
0
ファイル: BuiltinFunctions.cs プロジェクト: jimdeselms/bifoql
        public static async Task <IBifoqlObject> Join(Location location, QueryContext context, IBifoqlString glue, IBifoqlArrayInternal stringList)
        {
            var strings = new List <string>();

            foreach (var s in stringList)
            {
                var str = await s() as IBifoqlString;

                if (str == null)
                {
                    return(new AsyncError(location, "Each member of join's string list must be a string"));
                }

                strings.Add(await str.Value);
            }

            var glueStr = await glue.Value;

            return(new AsyncString(string.Join(glueStr, strings)));
        }
コード例 #2
0
ファイル: BuiltinFunctions.cs プロジェクト: jimdeselms/bifoql
        public static async Task <IBifoqlObject> ToNumber(Location location, QueryContext context, IBifoqlString str)
        {
            double dbl;

            if (double.TryParse(await str.Value, out dbl))
            {
                return(new AsyncNumber(dbl));
            }
            else
            {
                return(new AsyncError(location, "Can't convert string into number"));
            }
        }
コード例 #3
0
ファイル: ObjectConverter.cs プロジェクト: jimdeselms/bifoql
 private static async Task <object> ToSimpleObject(IBifoqlString str)
 {
     return(await str.Value);
 }