Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #3205
| From | Siratinee Sukachai <ploy.sukachai@gmail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Can I check contain value in hash? |
| Date | Tue, 19 Apr 2011 23:02:19 -0500 |
| Organization | Service de news de lacave.net |
| Lines | 15 |
| Message-ID | <4c6b84f27beab6e6f15f2d315a4bef87@ruby-forum.com> (permalink) |
| NNTP-Posting-Host | bristol.highgroove.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | talisker.lacave.net 1303272167 27694 65.111.164.187 (20 Apr 2011 04:02:47 GMT) |
| X-Complaints-To | abuse@lacave.net |
| NNTP-Posting-Date | Wed, 20 Apr 2011 04:02:47 +0000 (UTC) |
| X-Received-From | This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway |
| X-Mail-Count | 381886 |
| X-Ml-Name | ruby-talk |
| X-Rubymirror | Yes |
| X-Ruby-Talk | <4c6b84f27beab6e6f15f2d315a4bef87@ruby-forum.com> |
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.ruby:3205 |
Show key headers only | View raw
I have hash which is contain list of string value.
I need to check is the value already contained in the key.
Add add the value to the key if the key is not contained that value.
Can I do that?
like in c#
if(!dict[key].contains(value))
{
dict[key].add(value);
}
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Next in thread | Find similar | Unroll thread
Can I check contain value in hash? Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-19 23:02 -0500
Re: Can I check contain value in hash? Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-04-20 02:49 -0500
Re: Can I check contain value in hash? Brian Candler <b.candler@pobox.com> - 2011-04-20 03:33 -0500
Re: Can I check contain value in hash? Robert Klemme <shortcutter@googlemail.com> - 2011-04-20 03:50 -0500
Re: Can I check contain value in hash? Brian Candler <b.candler@pobox.com> - 2011-04-20 10:25 -0500
Re: Can I check contain value in hash? Robert Klemme <shortcutter@googlemail.com> - 2011-04-21 02:12 -0500
csiph-web