Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Scripts and Functions (v2) • Re: Sequence generator

$
0
0

Template is fed into the Format function, supporting any format option defined in the docs.

@kunkel321 I have mentioned this in the post :D

For the format string you tested, the syntax of the first parameter of Format is {Index:Format}. Index can only be 1 in this case as only a single value is provided to the function. It can be omitted if only one placeholder is used. Now to the other side - format specifiers,

  1. A decimal integer indicates the "width", or padding of the string;
    By default, values are right-aligned and spaces are used for padding.
    Format - Syntax & Usage

  2. A character from the type table indicates the type of the value, x means hexadecimal.


So :2x means, left pad 2 spaces and transform the value to hex.
I mainly use this to add leading zeroes by prefixing 0 to the width specifier, like so :02, producing the following:

01
02
03
04
05
06
07
08
09
10


There are of course many more possibilities with this function :trollface:

Statistics: Posted by william_ahk — Today, 19:21



Viewing all articles
Browse latest Browse all 579

Trending Articles