W
Size: a a a
L
НА
НА
НА
L
Иванов Иван бюль-бюль оглы Иванович
const firstName = 'Иванов'
const secondName = 'Иван бюль-бюль оглы'
const thirdName = 'Иванович'
L
L
L
L
"иВанов иВан иваНович".toLowerCase().replace(/(^|\s)./g, m => m.toUpperCase())
L
"иВанов иВан иваНович"
.toLowerCase()
.split(" ")
.map(w => w.slice(0, 1).toUpperCase() + w.slice(1))
.join(" ")
L
let s = "иВанов иВан иваНович".toLowerCase()
let r = ""
for(let i = 0; i < s.length; ) {
const c = () => s.slice(i, i+1)
for(; c() === " " && i < s.length; i++) r += c()
r += c().toUpperCase()
for(i++; c() !== " " && i < s.length; i++) r += c()
}
L
const toUpperWords = (s, prevChar = " ", currChar = s.slice(0, 1)) =>
currChar && ( ( prevChar === " " && currChar !== " " ?
currChar.toUpperCase() : currChar.toLowerCase() ) + toUpperWords(s.slice(1), currChar) )
L
let s = "иВанов иВан иваНович"
s = s.toLowerCase()
s = s.slice(0, 1).toUpperCase() + s.slice(1)
s = s.slice(0, 7) + s.slice(7, 8).toUpperCase() + s.slice(8)
s = s.slice(0, 12) + s.slice(12, 13).toUpperCase() + s.slice(13)