开发者

Ab Initio - Formatting a number in Left alignment

开发者 https://www.devze.com 2022-12-28 08:38 出处:网络
I have a requirement in Ab Initio to format a number in left alignment. I shouldn\'t be using String conversion (as Strings are left aligned by 开发者_开发问答default), as it might cause compatibility

I have a requirement in Ab Initio to format a number in left alignment. I shouldn't be using String conversion (as Strings are left aligned by 开发者_开发问答default), as it might cause compatibility problems in the other end.

For example, if my Field has 7 bytes length, and I'm getting only two digits as my input, then these two digits should go into the first two bytes of my field (left aligned), instead of the last two bytes.

So, is there any in-built function in Ab Initio, that can format a number as left aligned?


You can convert it to string and let it ride. Ab Initio will automatically convert between string and decimal. Also, the physical representation will be the same for these two types.

If you are trying to use a non-ascii based format (int, float, etc.) I don't think there is a built-in function for this and you will probably have to do something rough like cast it to a void type then to a string type using hex_to_string() to preserve the exact bits and then right pad with spaces.

0

精彩评论

暂无评论...
验证码 换一张
取 消