countryDeterminer
Adds a 'the' determiner to the input country name, if one is required.
Parameters
COUNTRY (string)
The input country name.
Notes
The input string is not recognized as a country unless it appears on Studio's in-built list of countries.
The input string is not recognized when it already includes a 'the' determiner.
To test if the input value is recognized, use the isCountry function.
If the input string is not recognized, the function returns the string (unchanged) with a minor warning.
Examples
ATL in Script | Result |
---|---|
| France |
| Germany |
| the Netherlands |
| the United Kingdom |
| the Kingdom of Saudi Arabia |
| the United States of America |
Minor warning scenarios
ATL in Script | Result | Minor Warning |
---|---|---|
| España | España' is not recognized as a country name. |
| Freedonia | 'Freedonia' is not recognized as a country name. |
When the function does NOT recognize the input value, it returns that value (unchanged) with a minor warning. The warning may prompt you to check that you've passed in the correct value and haven't made a mistake.
If you know your data contains non-recognized names (e.g. non-English spellings), you might want to avoid generating the minor warning. To do this, use isCountry function to test the name. For example, you can create a user-defined function (UDF) that returns a non-recognized value (unchanged) but WITHOUT the minor warning.
Create a script and name it countryDet.
Add the following content:
#value countryDet(countryName) [[isCountry(countryName) ? countryDeterminer(countryName) : countryName]]
This content creates a UDF called
countryDet
. The UDF takes one parameter (countryName
), to which you input a country name in STRING form. The UDF uses the isCountry function to check if the country name is recognized. If true, the UDF passes the name into thecountryDeterminer
function; if false, the UDF returns the input value unchanged. There is no minor warning.Try calling the UDF in another script. For example:
ATL in Script
Result
Minor Warning
[[countryDet('España')]]
España
N/A
[[countryDet('Freedonia')]]
Freedonia
N/A
[[countryDet('the Republic of Freedonia')]]
the Republic of Freedonia
N/A
[[countryDet('Netherlands')]]
the Netherlands
N/A
[[countryDet('the Netherlands')]]
the Netherlands
N/A
[[countryDet('United States of America')]]
the United States of America
N/A
[[countryDet('the United States of America')]]
the United States of America
N/A