Skip to content

Commit 036e2e2

Browse files
committed
Added uppercase-lowercase converter tool
1 parent f3d4e6e commit 036e2e2

1 file changed

Lines changed: 114 additions & 0 deletions

File tree

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6+
<title>Text Tools Pack</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
background: #f5f7fa;
11+
margin: 0;
12+
padding: 0;
13+
color: #333;
14+
}
15+
.container {
16+
max-width: 800px;
17+
margin: 50px auto;
18+
background: #fff;
19+
padding: 20px;
20+
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
21+
border-radius: 8px;
22+
}
23+
h1 {
24+
text-align: center;
25+
color: #4CAF50;
26+
}
27+
textarea {
28+
width: 100%;
29+
height: 150px;
30+
margin: 10px 0;
31+
padding: 10px;
32+
border: 1px solid #ddd;
33+
border-radius: 5px;
34+
font-size: 16px;
35+
}
36+
button {
37+
background: #4CAF50;
38+
color: #fff;
39+
border: none;
40+
padding: 10px 15px;
41+
margin: 5px;
42+
border-radius: 5px;
43+
cursor: pointer;
44+
}
45+
button:hover {
46+
background: #45a049;
47+
}
48+
.output {
49+
background: #f1f1f1;
50+
padding: 10px;
51+
margin-top: 15px;
52+
border-radius: 5px;
53+
}
54+
.counter {
55+
margin-top: 10px;
56+
color: #666;
57+
}
58+
</style>
59+
</head>
60+
<body>
61+
<div class="container">
62+
<h1>🛠️ Text Tools Pack</h1>
63+
<textarea id="inputText" placeholder="Enter your text here..."></textarea><br/>
64+
65+
<button onclick="toUpperCase()">🔠 UPPERCASE</button>
66+
<button onclick="toLowerCase()">🔡 lowercase</button>
67+
<button onclick="removeSpaces()">🧹 Remove Extra Spaces</button>
68+
<button onclick="copyToClipboard()">📋 Copy Text</button>
69+
70+
<div class="counter" id="textStats"></div>
71+
72+
<div class="output">
73+
<strong>Output:</strong>
74+
<pre id="outputText"></pre>
75+
</div>
76+
</div>
77+
78+
<script>
79+
const inputText = document.getElementById("inputText");
80+
const outputText = document.getElementById("outputText");
81+
const textStats = document.getElementById("textStats");
82+
83+
inputText.addEventListener("input", updateStats);
84+
85+
function updateStats() {
86+
const text = inputText.value;
87+
const wordCount = text.trim().split(/\s+/).filter(Boolean).length;
88+
const charCount = text.length;
89+
textStats.innerText = `📝 Words: ${wordCount} | 🔤 Characters: ${charCount}`;
90+
}
91+
92+
function toUpperCase() {
93+
const text = inputText.value.toUpperCase();
94+
outputText.innerText = text;
95+
}
96+
97+
function toLowerCase() {
98+
const text = inputText.value.toLowerCase();
99+
outputText.innerText = text;
100+
}
101+
102+
function removeSpaces() {
103+
const text = inputText.value.replace(/\s+/g, ' ').trim();
104+
outputText.innerText = text;
105+
}
106+
107+
function copyToClipboard() {
108+
navigator.clipboard.writeText(outputText.innerText).then(() => {
109+
alert("✅ Text copied to clipboard!");
110+
});
111+
}
112+
</script>
113+
</body>
114+
</html>

0 commit comments

Comments
 (0)