本文整理汇总了TypeScript中@jupyterlab/csvviewer.parseDSVNoQuotes函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parseDSVNoQuotes函数的具体用法?TypeScript parseDSVNoQuotes怎么用?TypeScript parseDSVNoQuotes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseDSVNoQuotes函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('handles changing the field delimiter', () => {
const data = `a\tb\tc\td\n0\t1\t2\t3\n4\t5\t6\t7\n`;
const options = { data, delimiter: '\t', rowDelimiter: '\n' };
let results;
results = parser({ ...options, columnOffsets: false });
expect(results.nrows).to.deep.equal(3);
expect(results.offsets).to.deep.equal([0, 8, 16]);
results = parser({ ...options, columnOffsets: true });
expect(results.nrows).to.deep.equal(3);
expect(results.ncols).to.deep.equal(4);
expect(results.offsets).to.deep.equal([
0,
2,
4,
6,
8,
10,
12,
14,
16,
18,
20,
22
]);
});
示例2: it
it('adjusts columns to match ncols', () => {
let data = `a,b,c,d\n0,\n1,2,3,4,5,6`;
let options = { data, rowDelimiter: '\n', ncols: 5 };
let results;
results = parser({ ...options, columnOffsets: false });
expect(results.nrows).to.eql(3);
expect(results.offsets).to.eql([0, 8, 11]);
results = parser({ ...options, columnOffsets: true });
expect(results.nrows).to.eql(3);
expect(results.ncols).to.eql(5);
expect(results.offsets).to.eql([
0,
2,
4,
6,
7,
8,
10,
10,
10,
10,
11,
13,
15,
17,
19
]);
});