函数原型

func (s1 string) versionGreater(s2 string) bool

参数介绍

参数名称参数介绍
s1需要进行比较的版本字符串
s2需要进行判断的版本字符串

举例

待转换数据转换语句输出结果
1.8.1"1.8.1".versionGreater("1.8.2")false
1.8.1.1-alpha"1.8.1.1-alpha".versionGreater("1.8.1-alpha")true
  • Response

    HTTP/1.1 200 OK
    Server: nginx
    Date: Sat, 07 Jan 2023 10:41:06 GMT
    Content-Type: text/html; charset=utf-8
    Connection: close
    Vary: Accept-Encoding
    Cache-Control: no-cache
    Content-Length: 85
    
    <!DOCTYPE html>
    <html>
    <head>
        <title>123</title>
    </head>
    <body>
    1.8.1
    </body>
    </html>
    
  • 匹配语句:"(?P<version>\\d\\.\\d\\.\\d\\.)".submatch(response.body_string)["version"].versionGreater("1.8.2")

  • 输出结果:false

Was this page helpful?