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));
            }



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

  • 相关阅读:
    实验五
    实验一
    实验四
    实验三
    实验8 SQLite数据库操作
    实验7 BindService模拟通信
    实验6 在应用程序中播放音频和视频
    实验5 数独游戏界面设计
    实验4 颜色、字符串资源的使用
    实验五 存储管理实验
  • 原文地址:https://www.cnblogs.com/gc2013/p/3907554.html
Copyright © 2011-2022 走看看