FormatHelper.cs 600 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace EVCB_OCPP.Packet.Utilities
  7. {
  8. public static class FormatHelper
  9. {
  10. /// <summary>
  11. /// 驗證字串長度是否小於最大允許長度
  12. /// </summary>
  13. /// <param name="input"></param>
  14. /// <param name="maxLength">最大允許長度</param>
  15. /// <returns></returns>
  16. public static bool Validate(string input, int maxLength)
  17. {
  18. return input != null && input.Length <= maxLength;
  19. }
  20. }
  21. }