Drop leading "0" from phone number and replace with +44

I have a html form and i need the 0 dropping from the phone number and +44 adding on to it. Is there a way to do this with script so that it submits properly on the form submission.

30 thoughts on “Drop leading "0" from phone number and replace with +44”

  1. You can use substring to take everything from the first character onwards and prepend "+44"

    const phoneNumber = "01234567890";
    const asIntl = "+44" + phoneNumber.substring(1)
    console.log(asIntl)
    Reply

Leave a Comment