Replace spaces with '==' in text
by Felipe Soares Barbosa Silveira
HTML
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Substituir Espaços</title>
<style>
body {
font-family: Arial, sans-serif;
}
#container {
width: 80%;
margin: 20px auto;
padding: 20px;
background-color: #f0f0f0;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
label {
display: block;
margin-bottom: 10px;
}
textarea {
width: 100%;
height: 100px;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0069d9;
}
</style>
</head>
<body>
<div id="container">
<h2>Substituir Espaços por ==</h2>
<label for="entrada">Texto de Entrada:</label>
<textarea id="entrada"></textarea>
<button onclick="substituirEspacos()">Substituir</button>
<label for="saida">Texto de Saída:</label>
<textarea id="saida" readonly></textarea>
</div>
<script>
function substituirEspacos() {
const textoEntrada = document.getElementById('entrada').value;
const novoTexto = textoEntrada.replace(/[^\S\n]+/g, '==');
document.getElementById('saida').value = novoTexto;
}
</script>
</body>
</html>