# New to Ruby from CF

**URL:** <https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211>\
**Category:** Ruby\
**Created:** [July 21, 2006, 12:18am UTC](https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211 "2006-07-21T00:18:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben-v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecb155/32.png) [@ben-v](https://www.ruby-forum.com/u/ben-v)\
**Post date:** [July 21, 2006, 12:18am UTC](https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211/1 "2006-07-21T00:18:53Z")

</div>

I’m new to Ruby and Rails from Coldfusion, and I am already finding how  
much easier Ruby programming is, yet one thing that I haven’t quite  
figured out how to do in Ruby is to test whether for example, a contains  
b. In Coldfusion we did , but I can’t seem to find a  
CONTAINS() function or operator in Ruby. What would be the Ruby  
equivalent of the code above? And How would I test if one var contains  
another, or another string? Thanks for your help and time.

---

<div class="post-metadata">

**Author:** ![ben-v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecb155/32.png) [@ben-v](https://www.ruby-forum.com/u/ben-v)\
**Post date:** [July 21, 2006, 12:25am UTC](https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211/2 "2006-07-21T00:25:28Z")

</div>

On 7/21/06, Ben V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m new to Ruby and Rails from Coldfusion, and I am already finding how  
> much easier Ruby programming is, yet one thing that I haven’t quite  
> figured out how to do in Ruby is to test whether for example, a contains  
> b. In Coldfusion we did , but I can’t seem to find a  
> CONTAINS() function or operator in Ruby. What would be the Ruby  
> equivalent of the code above? And How would I test if one var contains  
> another, or another string? Thanks for your help and time.

if a.include? b

Check the documentation for Array and Hash.

---

<div class="post-metadata">

**Author:** ![ben-v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecb155/32.png) [@ben-v](https://www.ruby-forum.com/u/ben-v)\
**Post date:** [July 21, 2006, 12:38am UTC](https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211/3 "2006-07-21T00:38:04Z")

</div>

Phillip H. wrote:

> Check the documentation for Array and Hash.

Also works for strings, if that’s what you meant. (Don’t know  
Coldfusion).

-Justin

---

<div class="post-metadata">

**Author:** ![ben-v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecb155/32.png) [@ben-v](https://www.ruby-forum.com/u/ben-v)\
**Post date:** [July 21, 2006, 1:15am UTC](https://www.ruby-forum.com/t/new-to-ruby-from-cf/99211/4 "2006-07-21T01:15:40Z")

</div>

Thanks, sorry for the stupid question, but hopefully I’ll get the hang  
of Ruby. You would consider CF as a relatively easy language, but it’s  
nothing like Ruby.
