playMaker

Author Topic: Matching smaller strings within larger strings  (Read 1411 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Matching smaller strings within larger strings
« on: July 02, 2014, 05:47:03 PM »
Looking for a way to create a profanity filter that will take one single string and find it within a longer string.  For example, where XXXX is the profanity:
Find "XXXX" in "abcdziXXXXplque".

Any ideas?

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: Matching smaller strings within larger strings
« Reply #1 on: July 08, 2014, 03:15:19 PM »
*boink*

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3634
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Matching smaller strings within larger strings
« Reply #2 on: July 08, 2014, 05:42:39 PM »
Use the String Contains action.

If you need to check a lot of strings you should probably look into Array Maker actions....

If it's an online project you might look into profanity filtering services like this:
http://www.webpurify.com/


artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: Matching smaller strings within larger strings
« Reply #3 on: July 09, 2014, 12:23:30 AM »
Oh that's a nice alternative I wasn't aware of (filtering services I mean). 

Either way, String Contains should work for what I need.  I am already using ArrayMaker for this, and splitting a text file of profanity to an array and checking against that.  It only needs to be very basic so I think this should work just fine.

Thank you!