Code generator for list of countries
The code generator adds boilerplate code to the text list of countries from Pedro Posada.
The resultant code can then be used for data population into databases or compiled within codes written with a programming language.
See some examples.
Using the code generator
The code generator takes in four input:
- Code to appear before the generator loops through the list of country names.
- Code to appear while the generator is looping through the list of country names.
- Flag to indicate whether the loop should include the last record. This flag is helpful for cases where the boiler plate coding for the last record is different from the rest. The first example demonstrates one such case.
- Code to appear after the generator loops through the list of country names.
Within the inputs, the generator recognises three types of format specifiers:
%NAME%
will be replaced by country names in the list. This format specifier is not available for the first input and for the last input when the “Till the last record” checkbox is unchecked.%NUMBER%
will be replaced by a index number. This number starts from 1 and incremented each time the generator loops through a country in the list. This format specifier is not available for the first input and for the last input when the “Till the last record” checkbox is unchecked.%TOTAL%
will be replaced by the total number of countries in the list. This format specifier is not available for the second input.