cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Pro extension simulates Bayesian Optimization runs. Prediction formulas stand in for experimental results. Run simulations and compare results. Download and use the extension.

Discussions

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

getting a string from a list, where string contains defined text

Hi,

 

can someone help me please? I have created a list that looks something like that:

{"C1234_here_is_some_text", "C1235_here_is_some_other_text", "C1236_you_get_the_idea", ..., "C2000_still_dont_ends_here"}

I want to get the complete string of the list where the first part of the string (e.g. "C1234") is "C1999".

Whats the correct code here?

Thank you in advance

 

1 REPLY 1
txnelson
Super User

Re: getting a string from a list, where string contains defined text

This is how I would do it

Names Default To Here( 1 );
x = {"C1234_here_is_some_text", "C1235_here_is_some_other_text", "C1236_you_get_the_idea", ..., "C2000_still_dont_ends_here"};

found = "Not Found";
For( i = 1, i <= N Items( x ), i++,
	If( Contains( x[i], "C1999" ) == 1,
		found = x[i];
		Break()
	)
);
show(found);
Jim

Recommended Articles