Indigo Rose Software
  #1  
Old 11-25-2008
SetupJuggler SetupJuggler is offline
Indigo Rose Customer
 
Join Date: Nov 2008
Location: Göttingen, Germany
Posts: 62
Missing a formatted printf for leading zeros

Hi,
I'm Using SUF 8.1.1006.0

I want to convert a number to a string specifying the with of the string and heaving leading zeros or spaces.
e.g. 1 => "001" or " 1".
I'm looking for a function, like the C printf("%03d", number) or printf("% 3d", number).

A String.Format() or NumberToString would be a nice feature.

If there is already a function to easy convert, please give me a hint and I appologize for inconvenience.

Udo
Reply With Quote
  #2  
Old 11-25-2008
Ulrich's Avatar
Ulrich Ulrich is offline
Indigo Rose Staff Member
 
Join Date: Apr 2005
Location: Sao Paulo, Brazil
Posts: 823
Quote:
Originally Posted by SetupJuggler View Post
I want to convert a number to a string specifying the with of the string and heaving leading zeros or spaces.
e.g. 1 => "001" or " 1".
I'm looking for a function, like the C printf("%03d", number) or printf("% 3d", number).
A String.Format() or NumberToString would be a nice feature.
If there is already a function to easy convert, please give me a hint and I appologize for inconvenience.
Hi Udo,

there are native Lua functions able to to this.

For example:
Code:
mystring = string.format("%03d", number);
hexa = string.format("%02X", number);
Ulrich
__________________
Reply With Quote
  #3  
Old 11-25-2008
SetupJuggler SetupJuggler is offline
Indigo Rose Customer
 
Join Date: Nov 2008
Location: Göttingen, Germany
Posts: 62
Thanks a lot Ulrich.

Tried it, works fine.
A hint within string online help would be appreciated to solve my problem.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there formatted string (i.e., printf) capability? Ken Gartner TrueUpdate 2.0 1 03-16-2005 10:18 AM
CR 8.5 Runtime Modules causing Build errors BurnMan2003 Setup Factory 6.0 7 10-10-2003 09:59 AM


All times are GMT -6. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software