xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HGetCaseMatch()

Retrieves the case sensitivity attribute of a hash.

Syntax

HGetCaseMatch( <hHash> ) --> lIsCaseSensitive

Arguments

<hHash>
A variable referencing the hash to retrieve the attribute from.

Return

The function returns the case sensitivity attribute of <hHash> as a logical value.

Description

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().

Info

See also:Hash(), HGetAutoAdd(), HSetAutoAdd(), HSetCaseMatch()
Category: Hash functions , xHarbour extensions
Source:vm\hash.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe