zoukankan      html  css  js  c++  java
  • c#代码实现GPS数据的有效性校验

    用于校验GPS报文指令的有效性 很简单的代码,留存吧

    public static bool Verify(string gpsInfo)         {
                if (gpsInfo == null || "".Equals(gpsInfo))
                    return false;

                char p = gpsInfo[0];
                char c = (char)0;

                int i = 1;
                for (; i < gpsInfo.Length; i++)
                {
                    p = gpsInfo[i];
                    if (p == '*')
                        break;
                    c ^= p;
                }

                if (p != '*')
                    return false;

                return gpsInfo.Substring(++i).Equals(string.Format("{0:X}", (int) c));
            }



    --------------------------------------

  • 相关阅读:
    Maven错误recv failed
    eclipse集成tomcat修改字符集参数
    eclipse luna 无法安装veloeclipse问题
    TortoiseSVN忽略文件夹
    类之特性
    __new()__与__init__()
    flask中models设计
    flask读书记录
    JS中的event 对象详解
    redis 持久化 RDB
  • 原文地址:https://www.cnblogs.com/gc2013/p/3907554.html
Copyright © 2011-2022 走看看