[Logo] Jaikoz and SongKong Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Mask to search for specific text "If text contains 'xyz' ? A : B"?  XML
Forum Index -> General
Author Message
rovertag

Pro

Joined: 18/04/2013 14:39:34
Messages: 43
Offline

I need a mask to search for specific text in comments / grouping. Can someone help me with this? It must apply an operation if the text *contains* something, but is not exactly equal to something.

Eg. Comments: "Classic Rock, Live Performance, Guitar: Les Paul,"

The mask does this:
"if comments contains 'Guitar: Les Paul', then do this : otherwise do something else"

I only know the arithmetic operators (< > == and such). Not sure about the operator for "contains".

Thanks!
paultaylor

Pro
[Avatar]

Joined: 21/08/2006 09:21:27
Messages: 7461
Online

Hi, you can use indexOf function for contains, and the >?: syntax for if.

So this simple mask outputs the title if it contains the text fred somewhere in the title otherwise it outputs the album.

Code:
title.indexOf("fred") > -1 ? title : album

thanks Paul (Administrator)
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.6 © JForum Team