Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
hmjason7
Contributor II
Contributor II

Convert String to Number

Hi All,

I need to convert a 16 character string into a number. The tricky thing is, the field is always a 16 character string in the form of:

"000000000001234" or "000000132454623" or "000000012300433".

As the last example suggests, I cannot simply trim all the 0's from the left hand side.

Any help would be much appreciated.

Cheers,

Jason

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Temp:

Load Num(Evaluate(Field),'#0') as Field Inline

[

  Field

  000000000001234

  000000132454623

  000000012300433

];

View solution in original post

5 Replies
MK_QSL
MVP
MVP

Temp:

Load Num(Evaluate(Field),'#0') as Field Inline

[

  Field

  000000000001234

  000000132454623

  000000012300433

];

Anonymous
Not applicable

do you need the "0" also in form of number?

then use

num(stringnumber,'0000000000000000')

should work

or what do you want?

hmjason7
Contributor II
Contributor II
Author

Thanks, works like a charm.

hmjason7
Contributor II
Contributor II
Author

No I didn't need the 0. So if it was "000000000001234", I just wanted to return '1234.

awhitfield
Partner - Champion
Partner - Champion

You could also try this


LOAD
replace(ltrim(replace(number, '0', ' ')), ' ', 0) as number

Regards

Andy