Forum: Ruby Check for two strings

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-01-29 12:53
Is this possible to check for two strings.
i want to check whether these two params exits i want to proceed the
process
i get two strings through form
search_string_1 = params[:first_name]
search _string_2 = params[:second_name]
if folder_name.include?(search_string_1)(search_string_2)

end

Any helps pls
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2009-01-29 13:09
(Received via mailing list)
2009/1/29 Newb Newb <revathy.p@angleritech.com>:
> Is this possible to check for two strings.
> i want to check whether these two params exits i want to proceed the
> process
> i get two strings through form
> search_string_1 = params[:first_name]
> search _string_2 = params[:second_name]
> if folder_name.include?(search_string_1)(search_string_2)

What kind of test do you want? Do you want both or at least one of them?

[search_string_1,search_string_2].all? {|s| folder_name.include? s}
[search_string_1,search_string_2].any? {|s| folder_name.include? s}

Cheers

robert
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-01-30 04:19
i have tried your code.
but it gives me argument error

[search_string_1,search_string_2].all? {|s| sub_folder_name.include? s}

pls help me
Thanks
This topic is locked and can not be replied to.