comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Case Insensitive Hash but still preserve cases of original keys
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Case Insensitive Hash but still preserve cases of original keys [message #89004 is a reply to message #89002] Mon, 14 July 2014 00:02 Go to previous messageGo to previous message
SonicKenking is currently offline  SonicKenking
Messages: 51
Registered: October 2010
Member
On Monday, July 14, 2014 4:53:53 PM UTC+10, Fabien wrote:
> Hi,
>
>
>
> On 14.07.2014 08:24, SonicKenking wrote:
>
>> I tried to implement a special Hash object with following features
>
>> 1. Keys are of String type
>
>> 2. Keys should be case insensitive
>
>> 3. The original cases of keys should be preserved and reported when the keys() method is called.
>
>
>
> this sounds like a dictionary to me:
>
>
>
> IDL> h = dictionary()
>
> IDL> h['X'] = 42
>
> IDL> print, h.keys()
>
> X
>
> IDL> print, h['x'], h['X']
>
> 42 42
>
> IDL> print, h.haskey('x'), h.haskey('X')
>
> 1 1
>
> IDL> h['x'] = 1337
>
> IDL> print, h['x'], h['X'] ; output 1337, 1337
>
> 1337 1337
>
> IDL> print, h.keys()
>
> x
>
>
>
> Cheers,
>
>
>
> Fabien

Hi Fabien,

Thanks for the reply. Unfortunately, Dictionary is not the solution in this case. Because the keys do not necessarily conform the naming rules of IDL variables, e.g. a key with white spaces "Some Key " or non-alphanumeric letter "<Key>".
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CONTOUR: Data coordinate system not established error
Next Topic: Normalize image after running FLAASH

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 23:56:58 PDT 2025

Total time taken to generate the page: 0.88065 seconds