回复:使用 Word() 或 Words() 函数解析列中的字符串如果您想要第一个索引(使用字() ) 与单词()语法应该类似于 Word(1, Vals[i], "-")
Names Default To Here(1);
str = "1bc5ef-gh7";
w1 = Words(str, "-");
show(w1);
show(w1[1]);
w2 = Word(1, str, "-");
show(w2);
回复:使用 Word() 或 Words() 函数解析列中的字符串JMP 有一个内置的文本到列() 函数。
Names default to here(1);
dt = New Table("split",
<< New Column("new_batch", character, <<SET values=""></SET>回复:使用 Word() 或 Words() 函数解析列中的字符串谢谢您的帮助。 我最终使用下面的代码将数据拆分为一个由分隔符分隔的新列。
dt3 << Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected
它给出以下输出

非常感谢您的帮助。
回复:使用 Word() 或 Words() 函数解析列中的字符串谢谢您的帮助。 word() 和 words() 的示例有效。 但是,我最终使用了下面的代码,因为它只需要 1 行并且更简单。
dt3 << Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected
使用 Word() 或 Words() 函数解析列中的字符串大家好,
我有一个表,其中一列包含字母数字字符串形式的数据(例如 1bc5ef-gh7),我想使用连字符作为分隔符来解析该字符串,它们返回字符串的第一部分( 1bc5ef) 作为新列中的数据。
到目前为止,我有下面的代码。 如果我使用单词秒() 函数,它只返回字符串的第二部分(例如 gh7)。 但是,如果我使用单词() 函数,RES 列表为空。
我想获取字符串的第一部分并将其放入同一个表中的新列中。
// there is a data table that already has a column called new_batch<BR /><BR /> Vals = :new_batch << Get Values; // Get Values out
Res = List(); // Define empty list
For(i = 1 , i <= N Items(Vals), i++,
Test = Words(Vals[i],"-"); // Words is the function that will split your string by delimiter
Insert Into(Res,Test[N Items(Test)]);
);
dt << New Column("new_batch_2", RES);
任何帮助表示赞赏。 谢谢,
质量与工艺工程