• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

drop first number

Guest
Jul 18, 2006 Jul 18, 2006

Copy link to clipboard

Copied

Hi i have a database column with phone numbers in

i need to display the number without the first zero ie

034544454455 needs to show 34544454455

is there a way to drop the first zero?
TOPICS
Advanced techniques

Views

245

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2006 Jul 18, 2006

Copy link to clipboard

Copied

<cfif left(telNumber,1) EQ "0">
<cfset telNumber = removeChars(telNumber,1,1)>
<cfoutput>#telNumber#</cfoutput>
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 21, 2006 Jul 21, 2006

Copy link to clipboard

Copied

ok thanks for that, this works below, how could i also get rid of any spaces that were entered?

<cfif left(Send.Phone,1) EQ "0">
<cfset PhoneNo = removeChars(Send.Phone,1,1)>
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jul 21, 2006 Jul 21, 2006

Copy link to clipboard

Copied

LATEST
If they are leading spaces after the 0 is removed, try using TRIM() after the 0 is removed, otherwise if they are leading/trailing spaces before the 0 is removed, try using TRIM() before you remove the 0. If they are just spaces within the string, just replace spaces with nothing.

<cfset PhoneNo = trim(removeChars(Send.Phone,1,1))>
--or--
<cfset PhoneNo =removeChars(trim(Send.Phone),1,1)>
--or--
<cfset PhoneNo =removeChars(replace(Send.Phone, " ", "", "all"),1,1)>

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation