i am an australian unfortunately living in europe and, apart from them not getting my jokes here, they don’t understand the way i write amounts of money because i put a full stop where they put a comma and vice versa.
so when i write 1,234.56 what i mean here is 1.234,56. but if i write to the australian bank they have no idea what i mean by 1.234,56.
i am sure if i was smarter i could write a little extension snippet which would easily convert one to the other but i am not. if a smart person was reading this and they were prepared to help me out i would be eternally grateful.
I will admit I asked ChatGPT to help. It works pretty well as a starter:
// #popclip
// name: Money Swap
// icon: iconify:noto-v1:money-mouth-face
// language: javascript
/**
* Convert between Australian (1,234.56) and European (1.234,56)
* number formats by swapping dots and commas appropriately.
*/
function swapMoneyFormat(text) {
// Trim whitespace
text = text.trim();
// Patterns to detect formats
const auPattern = /^[0-9]{1,3}(?:,[0-9]{3})*(?:\.[0-9]+)?$/;
const euPattern = /^[0-9]{1,3}(?:\.[0-9]{3})*(?:,[0-9]+)?$/;
if (auPattern.test(text)) {
// AU → EU
let [intPart, decPart] = text.split('.');
// Replace thousands commas with dots
intPart = intPart.replace(/,/g, '.');
// Join with comma as decimal separator if present
return decPart != null ? `${intPart},${decPart}` : intPart;
}
if (euPattern.test(text)) {
// EU → AU
let [intPart, decPart] = text.split(',');
// Replace thousands dots with commas
intPart = intPart.replace(/\./g, ',');
// Join with dot as decimal separator if present
return decPart != null ? `${intPart}.${decPart}` : intPart;
}
// If it doesn't match either, leave unchanged
return text;
}
popclip.pasteText(swapMoneyFormat(popclip.input.text));
(The above block is an extension snippet — select it then click “Install Extension” in PopClip.)
@nick you are a saint and you will go to heaven. thank you. and i will smile every time i click on the dorky icon which is saving me significant time and energy… again. thanks to you and popclip.