cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Add flag to Words() function to allow delimiters to be treated as one instead of many

Currently JMP's Words() function will split by any characters found from delimiters. Add a flag parameter which would allow user to use the delimiter string as one instead of any

 

Names Default To Here(1);

str1 = "a.,b.,c,d"; // last value should be c,d
//Show(Items(str1, ".,"));
Show(Words(str1, ".,"));

Most likely same feature could be added to Word(), Item() and Items() as they perform similar operations.

 

4 Comments
Jeff_Perkinson
Community Manager

Admittedly, a flag (or new function) as suggested would be nice but it's not too bad to deal with now by using Substitute() to convert the delimiter string into a single character.

 

str1 = "a.,b.,c,d.,e,f";

words(substitute(str1, ".,", "-"), "-");

//{"a", "b", "c,d", "e,f"}

 You do have to choose a character that doesn't appear anywhere in the string.

hogi
Level XI

In general, I would prefer to implement such standard options in the function - even if there is kind of a workaround.

The benefit of the "option": EVERY user can use the option, but just a few users will find the workaround (on their own or by community search) 

 

Nevertheless: nice workaround -> ideal candidate for Scripting Index 2.0

JMP Scripting Index feedback and discussion 

 

This option (define the whole sequence of characters as a single separator) would be a great improvement for Col/Utilities/Text to columns 

Here @Jeff_Perkinson 's trick can be applied as well - but nobody would substitute in JSL and then use Text to columns to split the phrase.

And there are for sure some Jmp users who will be happy to have a non-JSL solution.

How about implementing it there as well?

Jeff_Perkinson
Community Manager
@hogi wrote:

but nobody would substitute in JSL and then use Text to columns to split the phrase.

 


There's an implication that my workaround could only work in JSL here. Indeed, you could easily do the Substitute() in the Formula Editor for a new column and then use Text to columns on the new column.

hogi
Level XI

good point.
What I mean is:
Users would love to get everything done just via Text to columns command from the menu -  without having to do anything in addition.

 

Such a checkbox could also improve the functionality to (MFI) txt import:

Here it's vice versa: MFI interprets several separator characters as several separators - but sometimes the user wants to import a table where (1 - N) spaces are used as a single separator.
--> a checkbox could help

ah, Spaces