Replace first character if it’s 0 from string

Can you please tell me that how to replace 0 from mobile number in expression if its first character. I am getting Mobile numbers in webhook Like (09887012345, 9887012345). So when ever a user input 0 in start then i want to replace it.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@dpk0021 , assuming the mobile number is referenced by the key mobile_number you can use the expression {{ $json.mobile_number.startsWith('0') ? $json.mobile_number.slice(1) : $json.mobile_number }}.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.