Beispiel #1
0
        public static DoubleExtractor GetInstance(string placeholder = NumbersDefinitions.PlaceHolderDefault)
        {
            if (!Instances.ContainsKey(placeholder))
            {
                var instance = new DoubleExtractor(placeholder);
                Instances.TryAdd(placeholder, instance);
            }

            return(Instances[placeholder]);
        }
Beispiel #2
0
        public CardinalExtractor(string placeholder = NumbersDefinitions.PlaceHolderDefault)
        {
            var builder = ImmutableDictionary.CreateBuilder <Regex, TypeTag>();

            // Add Integer Regexes
            var intExtract = new IntegerExtractor(placeholder);

            builder.AddRange(intExtract.Regexes);

            // Add Double Regexes
            var douExtract = new DoubleExtractor(placeholder);

            builder.AddRange(douExtract.Regexes);

            Regexes = builder.ToImmutable();
        }
        private CardinalExtractor(string placeholder = NumbersDefinitions.PlaceHolderDefault)
        {
            var builder = ImmutableDictionary.CreateBuilder <Regex, string>();

            //Add Integer Regexes
            var intExtract = IntegerExtractor.GetInstance(placeholder);

            builder.AddRange(intExtract.Regexes);

            //Add Double Regexes
            var douExtract = DoubleExtractor.GetInstance(placeholder);

            builder.AddRange(douExtract.Regexes);

            Regexes = builder.ToImmutable();
        }