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.

51 lines
1.3 KiB

  1. #if NET40 || NET461
  2. using System;
  3. namespace Apewer.Internals.QrCode
  4. {
  5. internal static class String40Methods
  6. {
  7. /// <summary>
  8. /// The IsNullOrWhiteSpace method from Framework4.0
  9. /// </summary>
  10. /// <returns>
  11. /// <c>true</c> if the <paramref name="value"/> is null or white space; otherwise, <c>false</c>.
  12. /// </returns>
  13. public static bool IsNullOrWhiteSpace(String value)
  14. {
  15. if (value == null) return true;
  16. for (int i = 0; i < value.Length; i++)
  17. {
  18. if (!Char.IsWhiteSpace(value[i])) return false;
  19. }
  20. return true;
  21. }
  22. public static string ReverseString(string str)
  23. {
  24. char[] chars = str.ToCharArray();
  25. char[] result = new char[chars.Length];
  26. for (int i = 0, j = str.Length - 1; i < str.Length; i++, j--)
  27. {
  28. result[i] = chars[j];
  29. }
  30. return new string(result);
  31. }
  32. public static bool IsAllDigit(string str)
  33. {
  34. foreach (var c in str)
  35. {
  36. if (!char.IsDigit(c))
  37. {
  38. return false;
  39. }
  40. }
  41. return true;
  42. }
  43. }
  44. }
  45. #endif