fork download
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Globalization;
  6. using System.Text.RegularExpressions;
  7.  
  8. namespace Enum
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. string sql = "INSERT INTO TABLE1(col1, col2, col3, col4, col5) VALUES (,NULL, NULL, NULL, NULL, NULL,)";
  15.  
  16. string nulls = "NULL";
  17. List<int> indexes = new List<int>();
  18. foreach (Match match in Regex.Matches(sql, nulls))
  19. {
  20. indexes.Add(match.Index);
  21. }
  22.  
  23. sql = sql.Remove(indexes[2], 4).Insert(indexes[2], "'abc'");
  24. Console.WriteLine(sql);
  25. }
  26. }
  27. }
  28.  
Success #stdin #stdout 0.06s 34088KB
stdin
Standard input is empty
stdout
INSERT INTO TABLE1(col1, col2, col3, col4, col5) VALUES (,NULL, NULL, 'abc', NULL, NULL,)