Given a string and a number:
int rowNumber = 5; var str = "%00002047{(11*rowNumber):D3}"; It is necessary to calculate the mathematical action (multiplication) between the constant ( 11 ) and the variable ( rowNumber ), after which the result is converted according to the format ( D3 ) and inserted into the initial row.
Mathematical actions can be +-/* .
The order of specifying a constant and a number can be either: (11*rowNumber) or (rowNumber*11) .
Sequencing:
11*5=55 формат D3 = 055 вставка результата = "%00002047055"; How to select an action (multiplication, for example), a constant, and how to insert the result back into the string? Is there a typical solution, for example, through a regular expression?
rowNumbervariable alwaysrowNumberused? 2. In the mysterious formatD3you are able to translate the number? 3. Lines - a thing, in general, unchangeable, so that in the end a new line will be assembled. - Regent