Fix ASCII spaces

This commit is contained in:
MrLetsplay 2023-12-05 20:26:56 +01:00
parent e813d3e5ba
commit d9f754ad57
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg

View File

@ -61,8 +61,8 @@ const ConvertBase: Component = () => {
//const [base64, setBase64] = createSignal('');
const [ascii, setAscii] = createSignal('');
function updateExcept(value: string, base: number, except: Setter<string>) {
const raw = value.replaceAll(/ /g, '');
function updateExcept(value: string, base: number, except: Setter<string>, preserveSpaces: boolean = true) {
const raw = preserveSpaces ? value : value.replaceAll(/ /g, '');
setError('');
@ -131,7 +131,7 @@ const ConvertBase: Component = () => {
{/*<h2>Base 64</h2>
<textarea value={base64()} oninput={e => updateExcept(e.currentTarget.value, 64, setBase64)} />*/}
<h2>ASCII</h2>
<textarea value={ascii()} oninput={e => updateExcept(e.currentTarget.value, 256, setAscii)} />
<textarea value={ascii()} oninput={e => updateExcept(e.currentTarget.value, 256, setAscii, true)} />
</Page >
);
};