Skip to content

Commit

Permalink
also add last item
Browse files Browse the repository at this point in the history
  • Loading branch information
rjahn committed Dec 10, 2024
1 parent 979f44b commit 05aa514
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/util/string-util/SplitWithQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ export function asList(value:string, delimiter:string = "'") {
let first:number = 0;
let last:number = 0;
let quote:boolean = false;
let added:boolean = false;

for (let i = 0; i < value.length; i++, last++) {
added = false;
let char = value[i];

if (char == ";") {
if (!quote) {
classes.push(value.substring(first, last).replaceAll("'", ""));

added = true;
first = i + 1;
last = i;
}
Expand All @@ -40,5 +43,9 @@ export function asList(value:string, delimiter:string = "'") {
}
}

if (!added) {
classes.push(value.substring(first, last).replaceAll("'", ""));
}

return classes;
}

0 comments on commit 05aa514

Please sign in to comment.