Exemplo n.º 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());
        }
Exemplo n.º 2
0
 protected override V Get(int index)
 {
     return(converter.Convert(@base[index]));
 }