mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-28 18:36:26 +00:00
Correctly Capatilize After Opening Bracket
Working and tested
This commit is contained in:
parent
0019c9656b
commit
8125a31fce
|
@ -25,9 +25,13 @@ function changeCase(txt, type){
|
|||
case 'upper': return txt.toUpperCase()
|
||||
case 'start':
|
||||
txt = txt.split(" ")
|
||||
for (let i = 0, q = 0; i < txt.length; i++)
|
||||
if (txt[i].substr(0, 1) === "(" || txt[i].substr(0, 1) === "[" || txt[i].substr(0, 1) === "{") q++;
|
||||
txt[i] = txt[i][q].toUpperCase() + txt[i].substr(q + 1).toLowerCase()
|
||||
for (let i = 0; i < txt.length; i++) {
|
||||
if (txt[i].startsWith("(") || txt[i].startsWith("[") || txt[i].startsWith("{")) {
|
||||
txt[i] = txt[i][0] + txt[i][1].toUpperCase() + txt[i].substr(2).toLowerCase()
|
||||
} else {
|
||||
txt[i] = txt[i][0].toUpperCase() + txt[i].substr(1).toLowerCase()
|
||||
}
|
||||
}
|
||||
return txt.join(" ")
|
||||
case 'sentence': return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase()
|
||||
default: return txt
|
||||
|
|
Loading…
Reference in a new issue