Format
typescript
CSV.GetItem(row, col)class: CSV
Description
Get the string data at the specified row and column of the current CSV table (both row and column indices start from 0).
Parameters
| param_name | type | description |
|---|---|---|
| row | number | The row index. |
| col | number | The column index. |
Return
| type | description |
|---|---|
string | The string data at the specified row and column. |
Code Example
typescript
let csv = Resources.Load<CSV>(CSV, "7524C80CF370442F0DA9F78C6E82CD4C");
if (csv == null) {
throw new Exception("failed to load csv");
}
let str = "";
let row = Math.trunc(Math.random() * 9 + 3);
let contentArr = new Array<Array<number>>(row);
for(let rowIdx = 0; rowIdx < row; rowIdx++){
let col = Math.trunc(Math.random() * 9 + 3);
contentArr[rowIdx] = new Array<number>(col);
for(let colIdx = 0;colIdx<col;colIdx++){
let val = Math.trunc(Math.random()*1000);
contentArr[rowIdx][colIdx] = val;
str += val.toString();
str+=",";
}
str+="\r\n";
}
csv.SetData(str);
Debug.Log("SetData: ");
Debug.Log(str);
Debug.Log("row:1,col:1 value is : ",csv.GetItem(1, 1));