-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
172 lines (155 loc) · 7.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<link href="https://getbootstrap.com/docs/5.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Case Converter | Convert upper case to lower case, lower case to upper case and more!</title>
<meta name="description" content="Easy to use case converter, text between different letter cases: lower case, UPPER CASE, Sentence case, Capitalized Case, aLtErNaTiNg cAsE and more online.">
<meta property="og:type" content="website" />
<meta property="og:image" content="https://www.copy-paste-fonts.com/promo.png" />
<meta property="og:url" content="https://www.copy-paste-fonts.com/case-converter" />
<meta property="og:title" content="Case Converter | Convert upper case to lower case, lower case to upper case and more!" />
<meta property="og:description" content="Easy to use case converter, text between different letter cases: lower case, UPPER CASE, Sentence case, Capitalized Case, aLtErNaTiNg cAsE and more online." />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
<div class="container sections-wrapper">
<div class="row">
<div class="primary col-md-8 col-sm-12 col-xs-12">
<section class="about section">
<div class="section-inner">
<div class="content">
<div class="container mt-5">
<!-- Main Content Start Here -->
<div class="container my-5">
<h1 class="text-center mb-4">Case Converter</h1>
<div class="form-group">
<label for="inputText">Enter text:</label>
<textarea class="form-control" id="inputText" rows="5"></textarea>
</div>
<br>
<div class="text-center">
<button class="btn btn-primary mr-2" onclick="convertToSentenceCase()">Sentence Case</button>
<button class="btn btn-primary mr-2" onclick="convertToLowercase()">Lowercase</button>
<button class="btn btn-primary mr-2" onclick="convertToUppercase()">UPPERCASE</button>
<button class="btn btn-primary mr-2" onclick="convertToCapitalizedCase()">Capitalized Case</button><br><br>
<button class="btn btn-primary mr-2" onclick="convertToAlternatingCase()">aLtErNaTiNg cAsE</button>
<button class="btn btn-primary mr-2" onclick="convertToTitleCase()">Title Case</button>
<button class="btn btn-primary mr-2" onclick="convertToInverseCase()">InVeRsE CaSe</button><br><br>
<button class="btn btn-success mr-2" onclick="downloadText()">Download Text</button>
<button class="btn btn-info" onclick="copyToClipboard()">Copy to Clipboard</button>
</div>
<br>
<div class="form-group">
<label for="outputText">Converted text:</label>
<textarea class="form-control" id="outputText" rows="5" readonly></textarea>
</div>
</div>
<script>
// Get references to the input and output textareas
const inputText = document.getElementById('inputText');
const outputText = document.getElementById('outputText');
// Function to convert text to sentence case
function convertToSentenceCase() {
const text = inputText.value.trim();
let newText = '';
if (text.length > 0) {
newText = text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
}
outputText.value = newText;
}
// Function to convert text to lowercase
function convertToLowercase() {
outputText.value = inputText.value.toLowerCase();
}
// Function to convert text to UPPERCASE
function convertToUppercase() {
outputText.value = inputText.value.toUpperCase();
}
// Function to convert text to capitalized case
function convertToCapitalizedCase() {
const text = inputText.value.trim();
let newText = '';
if (text.length > 0) {
newText = text.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ');
}
outputText.value = newText;
}
// Function to convert text to alternating case
function convertToAlternatingCase() {
const text = inputText.value.trim();
let newText = '';
for (let i = 0; i < text.length; i++) {
const char = text.charAt(i);
newText += i % 2 === 0 ? char.toUpperCase() : char.toLowerCase();
}
outputText.value = newText;
}
// Function to convert text to title case
function convertToTitleCase() {
const text = inputText.value.trim();
let newText = '';
if (text.length > 0) {
newText = text.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ');
}
outputText.value = newText;
}
// Function to convert text to inverse case
function convertToInverseCase() {
const text = inputText.value.trim();
let newText = '';
for (let i = 0; i < text.length; i++) {
const char = text.charAt(i);
newText += char === char.toUpperCase() ? char.toLowerCase() : char.toUpperCase();
}
outputText.value = newText;
}
// Function to download the output text as a text file
function downloadText() {
const text = outputText.value;
const filename = 'converted-text.txt';
const blob = new Blob([text], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.click();
}
// Function to copy the output text to the clipboard
function copyToClipboard() {
outputText.select();
document.execCommand('copy');
}
</script>
<!-- Main Content Ends Here-->
</div><!--//content-->
</div><!--//section-inner-->
</section><!--//section-->
<section class="github section">
</section><!--//section-->
</div><!--//primary-->
<div class="secondary col-md-4 col-sm-12 col-xs-12">
</div><!--//secondary-->
</div><!--//row-->
</div><!--//masonry-->
<div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<p class="col-md-4 mb-0 text-muted">© 2023 <a href="https://www.Copy-Paste-Fonts.com">Copy and Paste Fonts</a></p>
<a href="/" class="col-md-4 d-flex align-items-center justify-content-center mb-3 mb-md-0 me-md-auto link-dark text-decoration-none">
<svg class="bi me-2" width="40" height="32"><use xlink:href="#bootstrap"/></svg>
</a>
</footer>
</body>
</html>