You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
824 B

4 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Apewer.Internals
  5. {
  6. internal static class TextHelper
  7. {
  8. public static StringPairs ParseConnectionString(string connectionString)
  9. {
  10. var sp = new StringPairs();
  11. if (string.IsNullOrEmpty(connectionString)) return sp;
  12. var split = connectionString.Split(";");
  13. foreach (var item in split)
  14. {
  15. var equal = item.IndexOf("=");
  16. if (equal < 0) continue;
  17. var left = item.Substring(0, equal).ToTrim();
  18. var right = item.Substring(equal + 1).ToTrim();
  19. if (left.IsEmpty() || right.IsEmpty()) continue;
  20. sp.Add(left, right);
  21. }
  22. return sp;
  23. }
  24. }
  25. }