3 Replies Latest reply on Jul 21, 2006 6:54 PM by paross1

    drop first number

    macca242424 Level 1
      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?
        • 1. Re: drop first number
          BKBK Adobe Community Professional & MVP
          <cfif left(telNumber,1) EQ "0">
          <cfset telNumber = removeChars(telNumber,1,1)>
          <cfoutput>#telNumber#</cfoutput>
          </cfif>
          • 2. Re: drop first number
            macca242424 Level 1
            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>
            • 3. drop first number
              paross1 Level 2
              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