Sorting words in a stringI would like to sort words alphabetically in a string. I am stuck trying to get the list back into one string.
string= "sort this sentence";
string_list = sort list(words(string )); // string_list = {"sentence", "sort", "this"};
Sorted_string = (string_list); // not sure how to create Sorted_string = "sentence sort this"
show(string, string_list, Sorted_string);Automation and ScriptingRe: Sorting words in a stringIn JMP you can use Concat Items()
Names Default To Here(1);
Concat Items({"www", "jmp", "com"}, "."); //"www.jmp.com"Re: Sorting words in a stringThanks you got me on the right track.
string= "sort this sentence";
string_list = sort list(words(string));
sorting_string = "";
for(i=1, i<=nitems(string_list), i++,
if(i<NITEMS></NITEMS><BR />----------------<BR />Log:<BR />string = "sort this sentence";<BR />string_list = {"sentence", "sort", "this"};<BR />Sorting_string = "sentence sort this";<BR />Re: Sorting words in a stringI still would suggest using Concat Items() in cases like this
Names Default To Here(1);
string = "sort this sentence";
string_list = Sort List(Words(string));
Sorted_string = Concat Items(string_list, " ");
Show(string, string_list, Sorted_string);
string = "sort this sentence";
string_list = {"sentence", "sort", "this"};
Sorted_string = "sentence sort this";Re: Sorting words in a stringPerfect! Thanks!