Dos: Character count control
Solved
Ka-El
Posted messages
279
Status
Member
-
Ka-El Posted messages 279 Status Member -
Ka-El Posted messages 279 Status Member -
Hello,
In a script I need to check the number of characters calculated by a variable "quant" which is the day’s ordinal (the day of the year). If the ordinal being checked is equal to 94 (for example) then I must add a "0" in front to always obtain a 3-digit result, i.e. 094 (the problem won’t occur after the ordinal "100"). How could I perform this operation in a batch script? I imagine I’ll need to use an "if"? Could you share a simple example? Thanks. K
P.S.: For an ordinal equal to "5", two "0"s must be added, i.e. "005".
In a script I need to check the number of characters calculated by a variable "quant" which is the day’s ordinal (the day of the year). If the ordinal being checked is equal to 94 (for example) then I must add a "0" in front to always obtain a 3-digit result, i.e. 094 (the problem won’t occur after the ordinal "100"). How could I perform this operation in a batch script? I imagine I’ll need to use an "if"? Could you share a simple example? Thanks. K
P.S.: For an ordinal equal to "5", two "0"s must be added, i.e. "005".