How to get rid of null character:splitting argument into 2d array
Hi,
I have got following code:
JavaScript:
module.exports = async function(callback)
{
try{
//https://stackoverflow.com/questions/8594097/javascript-split-string-into-2d-array
let allArgStr= "address to, uint amount";
let sepEachArgArray = allArgStr.split(",");
for (let i = 0; i < sepEachArgArray.length; i++) {
sepEachArgArray[i] = sepEachArgArray[i].split(" ");
}
console.log(sepEachArgArray);
}
catch(error){
console.log(error)
}
callback();
}
l$ truffle exec split_arg_into2d.js
Using network 'development'.
[ [ 'address', '', 'to' ], [ '', 'uint', 'amount' ] ]
$
Somebody please guide me how to get rid of null character.
Zulfi.