Büyük/Küçük Harf Dönüştürücü
Büyük/Küçük Harf Dönüştürücü
Metninizi buraya girin:
Dönüştürme Geçmişi
let history = [];
// Metni dönüştürme
function convertCase(type) {
let textElement = document.getElementById(“textInput”);
// contenteditable alanından metni al
let textContent = textElement.innerText;
if (type === “uppercase”) {
textContent = textContent.toUpperCase();
} else if (type === “lowercase”) {
textContent = textContent.toLowerCase();
} else if (type === “titlecase”) {
// Her kelimenin ilk harfini büyük yap
textContent = textContent.replace(/\\w\\S*/g, function(word) {
return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
});
} else if (type === “sentencecase”) {
// Sadece ilk harfi büyük, gerisi küçük
if (textContent.length > 0) {
textContent = textContent.charAt(0).toUpperCase() + textContent.slice(1).toLowerCase();
}
}
// Dönüştürülen metni yeniden at
textElement.innerText = textContent;
// Geçmişe ekle
addToHistory(textContent);
}
// Kopyalama fonksiyonu
function copyText() {
let textContent = document.getElementById(“textInput”).innerText;
navigator.clipboard.writeText(textContent).then(() => {
alert(“Metin panoya kopyalandı!”);
}).catch(err => {
alert(“Kopyalama başarısız: ” + err);
});
}
// Yapıştırma fonksiyonu
function pasteText() {
navigator.clipboard.readText().then(text => {
document.getElementById(“textInput”).innerText = text;
}).catch(err => {
alert(“Panodan okuma başarısız: ” + err);
});
}
// Dönüştürme geçmişine ekle
function addToHistory(text) {
history.unshift(text);
if (history.length > 10) {
history.pop();
}
updateHistoryUI();
}
// Geçmiş listesini güncelle
function updateHistoryUI() {
let historyList = document.getElementById(“historyList”);
historyList.innerHTML = “”;
history.forEach(item => {
let li = document.createElement(“li”);
li.innerText = item;
historyList.appendChild(li);
});
}