示例#1
0
        public static string ReplaceNoDollarVars(string str, Net.Vpc.Upa.Impl.Util.Converter <string, string> varConverter)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            {
                bool javaExprSupported = true;
                if (javaExprSupported)
                {
                    Net.Vpc.Upa.Impl.Util.Regexp.PortablePattern        p = new Net.Vpc.Upa.Impl.Util.Regexp.PortablePattern("\\{[^\\{\\}]*\\}");
                    Net.Vpc.Upa.Impl.Util.Regexp.PortablePatternMatcher m = p.Matcher(str == null ? "" : str);
                    while (m.Find())
                    {
                        string g = m.Group(0);
                        string v = g.Substring(1, (g).Length - 1);
                        sb.Append(m.Replace(varConverter.Convert(v)));
                    }
                    sb.Append(m.Tail());
                    return(sb.ToString());
                }
            }
            int i = 0;

            while (i >= 0 && i < (str).Length)
            {
                int j = str.IndexOf("{", i);
                if (j < 0)
                {
                    sb.Append(str.Substring(i));
                    i = -1;
                }
                else
                {
                    sb.Append(str.Substring(i, j));
                    int k = str.IndexOf("}", j + 1);
                    if (k < 0)
                    {
                        sb.Append(varConverter.Convert(str.Substring(j + 1)));
                        i = -1;
                    }
                    else
                    {
                        sb.Append(varConverter.Convert(str.Substring(j + 1, k)));
                        i = k + 1;
                    }
                }
            }
            return(sb.ToString());
        }
示例#2
0
 public ConvertedEnumerator(IEnumerator <K> source, Converter <K, V> converter)
 {
     this.source    = source;
     this.converter = converter;
 }
示例#3
0
 public ConvertedList(System.Collections.Generic.IList <K> @base, Net.Vpc.Upa.Impl.Util.Converter <K, V> converter)
 {
     this.@base     = @base;
     this.converter = converter;
 }