contents   index   previous   next



Buffer.compare ()

syntax:

Buffer.compare(buffer1,buffer2)

where:

buffer1,buffer2 - Two buffer objects to be compared.

 

return:

negative if buffer1 < buffer2,
zero if buffer1 == buffer2
positive if buffer1 > buffer2

 

description:

There is no insensitive compare, Buffer.comparei(), since buffers are not strings.To compare buffers as strings, use the toString() or valueOf() methods and make string comparisons. By using these methods, ASCII and Unicode buffers, holding string data, may be compared.

 

see:

Buffer(), Buffer compare(), Buffer.equal (), Buffer equal()

 

example:

// The following code:

var bufa = Buffer("ab");

var bufb = new Buffer("ab\0");

var cmp = Buffer.compare(bufa,bufb)

// will set the variable cmp to be < 0


Buffer.equal ()