Ask a Question

How to use Format function to format a string.

sguda
Regular Contributor

How to use Format function to format a string.

I have an string variable that increments in the script everytime the script runs. ex: variable with value 02. Tried to Format this in the form of "0000" using aqstring.Format("0000", Variablestring). I am not able to.  Can you pleasetell me if there is a solution. I tried the format specifics under the format expression with the help. but could not.


3 REPLIES 3
sguda
Regular Contributor

I have string variable with value "2". i want to fomat it to "0002". I used aqstring.format("0000", my string variable with vale :"2").

I am not able to. can any one suggest.
tppegu
Contributor

numericString = "2"

formattedString = aqString.Format("%04i", aqConvert.StrToInt(numericString))
sguda
Regular Contributor

Thankyou very much, that worked.
cancel
Showing results for 
Search instead for 
Did you mean: