How to find a string within a string?

30 views
Skip to first unread message

John Lynn

unread,
Apr 5, 2013, 11:30:11 PM4/5/13
to dtr...@googlegroups.com
How would I test a string to see if it contains some literal string - for example: to see if RearForwardFacing contains the string "Reversible" somewhere in it?

I see "matches" mentioned in the BNF doc at http://dtrules.com/wiki2/index.php?title=BNF.txt -- but how is it used? Is it a regex matcher?

Thanks for any examples! 

paul snow

unread,
Apr 11, 2013, 8:18:31 AM4/11/13
to dtr...@googlegroups.com
John!

I want to apologize for the slow response!  I read your email while out of town, then kept forgetting to respond!

You can indeed use matches for your test!  It is a regex matcher, and it uses Java regular expressions. (See http://docs.oracle.com/javase/tutorial/essential/regex/)  So looking for "Reversible" can be done like this in a condition

        RearForwardFacing matches ".*Reversible.*"

Paul



--
You received this message because you are subscribed to the Google Groups "DTRules" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dtrules+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Paul Snow
Fax:    (419) 831-9962 
skype: paulsnx2
Reply all
Reply to author
Forward
0 new messages