Hash Compare

Johnny bierbauch at jenz.info
Wed Apr 18 09:13:39 PDT 2007


Hello,

I've got a problem. I need to check if a hash key exists in a for loop like:

int [char[]] a;
int [char[]] b;

a = { a => 1; b => 5; c=> 8 }
b = { a => 5; b => 4; d => 3; f => 4 }

foreach (m; a.keys) {
  if ( b[m] ) {
   writefln("%s %s %s", m, a[m], b[m])
  }
  else {
    writefln("%s %s", m, a[m])
  }
}

... not "real" D but I hope you understand the code and what it should do.
Thanks.



More information about the Digitalmars-d-learn mailing list