Mein idee ist ersetzt. < /P>
Code: Select all
$show = String(value).replace(/^(\d{3})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/,
"$1.$2.$3.$4.$5");
< /code>
Aber ich habe keine Ahnung von der Ersatzstruktur.
Gibt es etwas Einfaches und kann mir jemand ein Beispiel geben?function formatString(str) {
const firstPart = String(str).slice(0, 3);
const remainingPart = String(str).slice(3);
let formattedString = firstPart + ".";
for (let i = 0; i < remainingPart.length; i += 2) {
formattedString += String(remainingPart).slice(i, i + 2) + ".";
}
return String(formattedString);
}