Monthly Archives: July 2014

Logical operators AND, OR in batch

There is no method to combine operators in windows BATCH command shell.
But we can easily emulate it!

For AND operator use next snippet:

if %var% GEQ 1 (
    if %var% LEQ 10 (
        // do...

For OR operator we have to use additional variable:

set result=false

if %var% LEQ 0 set result=true
if %var% GEQ 10 set result=true

if "%result%" EQU "true" (
   // do...

Thanx to

Capitalize word algorithm in Java

Here is simple snippet to capitalize string:

private static String capitalize(String value) {
    return value == null ? null : 
        value.substring(0, 1).toUpperCase() + value.substring(1);


Thanx to