anto
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
function convertStringToArray(inputString) {
|
||||
// Split the string by the delimiter '/'
|
||||
const stringArray = inputString.split(",");
|
||||
function convertStringToArray(string) {
|
||||
console.log(string)
|
||||
const numberStrings = string.replace(/[{}]/g, '').split(',');
|
||||
|
||||
// Convert each element to a number
|
||||
const numberArray = stringArray.map(Number);
|
||||
// Trim whitespace and convert the string numbers to integers
|
||||
const numberArray = numberStrings.map(num => parseInt(num.trim(), 10));
|
||||
|
||||
return numberArray;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user