示例#1
0
        private string InsertQuotedStrings(string strC, List <string> h)
        {
            StringBuilder sb           = new StringBuilder();
            StringBuilder QuotedString = null;

            for (int intI = 0; intI < strC.Length; intI++)
            {
                char chrC = strC[intI];
                if (chrC == '"')
                {
                    if (QuotedString == null)
                    {
                        QuotedString = new StringBuilder();
                    }
                    else
                    {
                        sb.Append('"');
                        int intNumber;
                        // State("default") is not a number, result of 'CorrectStates'
                        if (int.TryParse(QuotedString.ToString(), out intNumber))
                        {
                            sb.Append(h[intNumber]);
                        }
                        else
                        {
                            sb.Append(QuotedString.ToString());
                        }
                        sb.Append('"');
                        QuotedString = null;
                    }
                    continue;
                }

                if (QuotedString == null)
                {
                    sb.Append(chrC);
                }
                else
                {
                    QuotedString.Append(chrC);
                }
            }
            return(sb.ToString());
        }