예제 #1
0
        /// <summary>
        /// add a value to the end of the string.
        /// </summary>
        /// <param name="InValue"></param>
        /// <returns></returns>
        public void Append(string InValue)
        {
            // prepare the value to be added to the CSV string.
            string prepValue;

            if (InValue == null)
            {
                InValue = "";
            }
            if ((ShouldQuoteValue(InValue) == true) ||
                (InValue.Length == 0))
            {
                prepValue = Stringer.Enquote(InValue, cQuoteChar, mTraits.QuoteEncapsulation);
                if (EncapsulateValues == true)
                {
                    prepValue = "_qv(" + prepValue + ")";
                }
            }
            else
            {
                prepValue = InValue;
            }

            // add the value to the string.
            AppendAsIs(prepValue);
        }
예제 #2
0
        /// <summary>
        /// add a value to the end of the string.
        /// </summary>
        /// <param name="InValue"></param>
        /// <returns></returns>
        public CsvString Add(string InValue)
        {
            // prepare the value to be added to the CSV string.
            string prepValue;

            if (InValue == null)
            {
                prepValue = "";
            }
            else if ((ShouldQuoteValue(InValue) == true) ||
                     (InValue.Length == 0))
            {
                prepValue = Stringer.Enquote(InValue, '"', QuoteEncapsulation.Escape);
                if (EncapsulateValues == true)
                {
                    prepValue = "_qv(" + prepValue + ")";
                }
            }
            else
            {
                prepValue = InValue;
            }

            // add the value to the string.
            AddString(prepValue);

            return(this);
        }