QuoteSingle() public static method

public static QuoteSingle ( string input ) : string
input string
return string
コード例 #1
0
        public string GetTableColumnValue(DataRow row, DataColumn col, string dateTimeFormat)
        {
            if (MyGetTableColumnValue != null)
            {
                return(MyGetTableColumnValue(row, col, dateTimeFormat));
            }

            StringBuilder result = new StringBuilder();

            if (row.IsNull(col))
            {
                result.Append("NULL");
            }
            else if (col.DataType.Name == "Integer" || col.DataType.Name == "Double" || col.DataType.Name == "Decimal" || col.DataType.Name == "Number")
            {
                result.AppendFormat(row[col].ToString().Replace(',', '.'));
            }
            else if (col.DataType.Name == "DateTime" || col.DataType.Name == "Date")
            {
                result.Append(Helper.QuoteSingle(((DateTime)row[col]).ToString(dateTimeFormat)));
            }
            else
            {
                string res = row[col].ToString().Replace("\r", " ").Replace("\n", " ");
                if (TrimText)
                {
                    res = res.Trim();
                }
                result.Append(Helper.QuoteSingle(res));
            }

            return(result.ToString());
        }
コード例 #2
0
        public string RootGetTableColumnValue(DataRow row, DataColumn col, string dateTimeFormat)
        {
            StringBuilder result = new StringBuilder();

            if (row.IsNull(col))
            {
                result.Append("NULL");
            }
            else if (IsNumeric(col))
            {
                result.AppendFormat(row[col].ToString().Replace(',', '.'));
            }
            else if (col.DataType.Name == "DateTime" || col.DataType.Name == "Date")
            {
                result.Append(Helper.QuoteSingle(((DateTime)row[col]).ToString(dateTimeFormat)));
            }
            else
            {
                string res = row[col].ToString();
                if (TrimText)
                {
                    res = res.Trim();
                }
                if (RemoveCrLf)
                {
                    res = res.Replace("\r", " ").Replace("\n", " ");
                }
                result.Append(Helper.QuoteSingle(res));
            }

            return(result.ToString());
        }
コード例 #3
0
        public string RootGetTableColumnValue(DataRow row, DataColumn col, string dateTimeFormat)
        {
            string result = "";

            if (row.IsNull(col))
            {
                result = "NULL";
            }
            else if (IsNumeric(col))
            {
                result = row[col].ToString().Replace(',', '.');
                if (!(row[col] is int) && MaxDecimalNumber >= 0 && result.Length > MaxDecimalNumber)
                {
                    string[] parts = result.Split('.');
                    if (parts.Length == 2 && parts[1].Length > MaxDecimalNumber)
                    {
                        result = parts[0] + "." + parts[1].Substring(0, MaxDecimalNumber);
                    }
                }
            }
            else if (col.DataType.Name == "DateTime" || col.DataType.Name == "Date")
            {
                result = Helper.QuoteSingle(((DateTime)row[col]).ToString(dateTimeFormat));
            }
            else
            {
                string res = row[col].ToString();
                if (TrimText)
                {
                    res = res.Trim();
                }
                if (RemoveCrLf)
                {
                    res = res.Replace("\r", " ").Replace("\n", " ");
                }
                result = Helper.QuoteSingle(res);
            }

            return(result.ToString());
        }