[SOLVED] AS_NUMBER to Integer

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

[SOLVED] AS_NUMBER to Integer

Post by PointsWell »

If you take a large number in a text field and then use AS_NUMBER to convert it to a number, the number that is output is floating point not an integer. Is there a way to convert that floating point number to an integer? Or better convert the text to an integer from the outset?

What is actually being attempted here is the stripping of any leading zeros from a telephone number in order to parse it ready for a REST API but there may not always be a leading zero
Last edited by PointsWell on Tue May 29, 2018 5:34 am, edited 1 time in total.
Jaymer
Posts: 2457
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: AS_NUMBER to Integer

Post by Jaymer »

a regular expression can also search for 0 or more 0's only at the beginning of a line.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: AS_NUMBER to Integer

Post by PointsWell »

Jaymer wrote:a regular expression can also search for 0 or more 0's only at the beginning of a line.
Doh Good ol' uncle Regex to the rescue again.

I used the following:

Code: Select all

REPLACE_PATTERN(PhoneRecords.Number, '\A[0]', '')
Post Reply