Automatic update: how to disable automatic update in Windows 7

Source: Internet
Author: User

Automatic update: how to disable automatic update in Windows 7

Comparison of version numbers

When automatic updates are implemented, the version number must be compared.

For example, compare the sizes of 1.0.6 and 1.0.7.

Solution:

Convert the string of the version number to an integer for comparison.

Steps:

1. Remove the decimal point in the string. (Use regular expressions)

2. Compare the length of two strings, and add 0 after the shorter end until the two strings have the same length. (To compare 1.0.5.1 and 1.0.6 ).

3. convert two strings to integer comparison.

The Code is as follows:

// Regular expression removes decimal point
// String str1 = "1.0.6" .replaceAll ("[.]", "");
// String str2 = "1.0.7" .replaceAll ("[.]", "");
String str1 = "1.0.5.1" .replaceAll ("[.]", "");
String str2 = "1.0.6" .replaceAll ("[.]", "");
The
// Add 0 padding for tails with different lengths
if (str1.length () <str2.length ()) {
for (int i = 0; i <str2.length ()-str1.length (); i ++) {
str1 + = "0";
}
} else {
for (int i = 0; i <str1.length ()-str2.length (); i ++) {
str2 + = "0";
}
}
The
int i1 = Integer.valueOf (str1);
int i2 = Integer.valueOf (str2);
The
System.out.println ("str1 => i1 =" + i1);
System.out.println ("str2 => i2 =" + i2); 


 

 

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.