回复:使用 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);
任何幫助表示讚賞。 謝謝,
質量與工藝工程