zoukankan      html  css  js  c++  java
  • java 判断是否大于指定版本号

    判断 a.b.c 格式的版本大小:

        public boolean is_version_great_than(String version) {
            boolean result = false;
            if (!StringUtil.isNullorEmpty(version)
                && version.indexOf(".") >= 0) {
                String[] version_num = version.split("\."); //必须转义
                String[] cur_num = clientVersion.split("\.");
                int loop_count = version_num.length;
                if (cur_num.length < version_num.length) {
                    loop_count = cur_num.length;
                }
                
                for (int i = 0; i < loop_count; i++) {
                    if (Integer.valueOf(cur_num[i]) > Integer.valueOf(version_num[i])) { // 当有一节大于就跳出
                        result = true;
                        break;
                    }
                }
            }
            return result;
        }

    结论:

  • 相关阅读:
    用VS Code写C++程序如何运行
    DRF
    DRF
    DRF
    DRF
    DRF
    DRF
    DRF
    DRF
    DRF
  • 原文地址:https://www.cnblogs.com/tommy-huang/p/9768466.html
Copyright © 2011-2022 走看看