cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
PowerOx327
Level I

How do I use contains function to find a part of a variable name?

Hi, 

 

I'm trying to find a way to execute a function which happens when a list contains the string "[String]" like so:

 

AAList = {"object1", "object2", "object3[String]"};

 

If( Contains( AAList, "[String]"),
Show("string is running") );

 

But the if function isn't executed because the contains function doesn't detect the "[String]".

Any way to solve this? 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How do I use contains function to find a part of a variable name?

Contains is looking for full matches from a list, that why it won't find the which is part of one of the items in the list [String]. You can convert the list to a string using Concat Items()

Names Default To Here(1);

AAList = {"object1", "object2", "object3[String]"};

If(Contains(Concat Items(AAList, "¤"), "[String]"),
	Show("string is running")
);

Or loop over the list and break when match is found.

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How do I use contains function to find a part of a variable name?

Contains is looking for full matches from a list, that why it won't find the which is part of one of the items in the list [String]. You can convert the list to a string using Concat Items()

Names Default To Here(1);

AAList = {"object1", "object2", "object3[String]"};

If(Contains(Concat Items(AAList, "¤"), "[String]"),
	Show("string is running")
);

Or loop over the list and break when match is found.

 

-Jarmo

Recommended Articles