cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Due to the recently reported Microsoft outage, users may be temporarily unable to access My JMP or experience a delay receiving their verification codes. If you have previously installed JMP on your computer, this outage should not impact your ability to access the software. My JMP services will be restored as soon as Microsoft resolves this issue.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install 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