cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

How to obtain all parts of a string except for the last segment?

How can I get all parts of a string except for the last segment? For example, given "This is a sentence," using -1 can get the last word "sentence." Using [1 3] can get "This is a," but since the string's length varies each time, the positions are not fixed. Is there a way to directly get all parts of the string except for the last segment?
Names Default To Here( 1 );
Word( -1, "This is a sentence" );
Word( [1 3], "This is a sentence" );
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to obtain all parts of a string except for the last segment?

Negative indexing

Word([1 -2], "This is a sentence");
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to obtain all parts of a string except for the last segment?

Negative indexing

Word([1 -2], "This is a sentence");
-Jarmo

Recommended Articles