xHarbour Reference Documentation > Function Reference |
Changes the case sensitivity attribute of a hash.
HSetCaseMatch( <hHash>, <lOnOff> ) --> hHash
The function returns a reference to <hHash>.
The function changes an attribute of a hash that identifies whether or not character string matching for keys is case sensitive. By default, this attribute is .T. (true) when a new hash is created. This causes keys consisting of character strings that differ only in case can be assigned different values.
Use function HGetCaseMatch() to retrieve the current setting of this attribute.
See also: | Hash(), HGetAutoAdd(), HGetCaseMatch(), HSetAutoAdd() |
Category: | Hash functions , xHarbour extensions |
Source: | vm\hash.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates case sensitivity of keys in a // new created hash and outlines the effect of changing // the case sensitivity attribute in a populated hash. PROCEDURE Main // create an empty hash LOCAL hHash := {=>} ? HGetCaseMatch( hHash ) // result: .T. // Populating the hash: hHash[ 'KEY' ] := 'UPPER CASE' hHash[ 'key' ] := 'lower case' hHash[ 'Key' ] := 'Mixed Case' ? Len( hHash ) // result: 3 ? hHash[ 'KEY' ] // result: UPPER CASE ? hHash[ 'key' ] // result: lower case ? hHash[ 'Key' ] // result: Mixed Case // Don't do this with a populated case sensitive hash HSetCaseMatch( hHash, .F. ) ? hHash[ 'KEY' ] // result: Mixed Case ? hHash[ 'key' ] // result: Mixed Case ? hHash[ 'Key' ] // result: Mixed Case RETURN
http://www.xHarbour.com