大家好,
我有一个表,其中一列包含字母数字字符串形式的数据(例如 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);
任何帮助表示赞赏。 谢谢,