xHarbour Reference Documentation > Function Reference |
Retrieves the case sensitivity attribute of a hash.
HGetCaseMatch( <hHash> ) --> lIsCaseSensitive
The function returns the case sensitivity attribute of <hHash> as a logical value.
The function retrieves 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. This default behaviour can be switched off using function HSetCaseMatch().
See also: | Hash(), HGetAutoAdd(), HSetAutoAdd(), HSetCaseMatch() |
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