Fydler UtilityBelt
String Utilities
Text & Development Tool
Input Text
Reverse
Reverse Words
UPPERCASE
lowercase
Trim
Trim Start
Trim End
Remove Spaces
Remove Line Breaks
Collapse Spaces
Escape HTML
ROT13
Shuffle
Count
Result
Copy
Copied to clipboard!
lucide.createIcons(); const input = document.getElementById('su-input'); const output = document.getElementById('su-output'); function apply(action) { const val = input.value; if (!val) return; let result = ''; switch (action) { case 'reverse': result = val.split('').reverse().join(''); break; case 'reverse-words': result = val.split(/\s+/).reverse().join(' '); break; case 'upper': result = val.toUpperCase(); break; case 'lower': result = val.toLowerCase(); break; case 'trim': result = val.trim(); break; case 'trim-start': result = val.trimStart(); break; case 'trim-end': result = val.trimEnd(); break; case 'no-spaces': result = val.replace(/\s+/g, ''); break; case 'no-breaks': result = val.replace(/\r?\n/g, ' '); break; case 'collapse': result = val.replace(/\s+/g, ' ').trim(); break; case 'escape': result = val.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); break; case 'pad-start': result = val.padStart(val.length + 3, ' '); // More useful: pad to match width { const len = parseInt(prompt('Pad to total length:', Math.max(val.length + 5, 20))) || val.length; const char = prompt('Pad character:', ' ') || ' '; result = val.padStart(len, char); } break; case 'pad-end': { const len = parseInt(prompt('Pad to total length:', Math.max(val.length + 5, 20))) || val.length; const char = prompt('Pad character:', ' ') || ' '; result = val.padEnd(len, char); } break; case 'count': result = `Length: ${val.length}\nChars (no space): ${val.replace(/\s/g, '').length}\nWords: ${val.trim() ? val.trim().split(/\s+/).length : 0}\nLines: ${val.split(/\r?\n/).length}`; break; case 'rot13': result = val.replace(/[a-zA-Z]/g, c => { const base = c <= 'Z' ? 65 : 97; return String.fromCharCode((c.charCodeAt(0) - base + 13) % 26 + base); break; case 'shuffle': result = val.split('').sort(() => Math.random() - 0.5).join(''); break; } if (result !== undefined) output.value = result; } document.querySelectorAll('.su-btn').forEach(btn => { btn.addEventListener('click', () => apply(btn.dataset.action)); }); document.getElementById('su-copy-btn').addEventListener('click', () => { const v = document.getElementById('su-output').value; if (v) { navigator.clipboard.writeText(v); showToast('Copied!'); } }); function showToast(msg) { const toast = document.getElementById('toast'); const toastMsg = document.getElementById('toast-message'); toastMsg.textContent = msg; toast.classList.add('show'); setTimeout(() => toast.classList.remove('show'), 2000); }