大家好,
我有一個表,其中一列包含字母數字字符串形式的數據(例如 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);
任何幫助表示讚賞。 謝謝,