ListAddress
objectA random address from the list read by `Csv.readAddress`, split into street, number, number addition, zip code and city. The first call to any part function picks a random data row (never the header row) and keeps it: all following calls return parts of that same address. `scramble` forgets it so the next call picks a new one. The file needs the header row and at least one data row; a file with only a header line or no lines throws an error when a part is requested. Column 1 is street and number (`Main Street 12a`), column 2 the zip code and column 3 the city.
- Kind Object
- Library Csv
- Category Files & Documents
- Functions 6
How to get one
- Csv .readAddress()
- ListAddress
local listAddress = Csv.readAddress(fileLocation, delimiter)Returned by
Functions
-
numberstring Returns the digits of the street column with everything else removed (`Main Street 12a` gives `12`). -
numberAddonstring Returns the text after the house number in the street column (`Main Street 12a` gives `a`), or an empty string when there is none. -
zipcodestring Returns the zip code column with every character removed that is not a letter, digit or whitespace. -
streetstring Returns the street column with the digits removed (`Main Street 12a` gives `Main Street a`). -
citystring Returns the city column of the current address, trimmed. -
scrambleself Forgets the current address so the next part function picks a new random one.
number()
Section titled “number()”listAddress.number()→string Returns the digits of the street column with everything else removed (`Main Street 12a` gives `12`).
Returns
numberAddon()
Section titled “numberAddon()”listAddress.numberAddon()→string Returns the text after the house number in the street column (`Main Street 12a` gives `a`), or an empty string when there is none.
Returns
zipcode()
Section titled “zipcode()”listAddress.zipcode()→string Returns the zip code column with every character removed that is not a letter, digit or whitespace.
Returns
street()
Section titled “street()”listAddress.street()→string Returns the street column with the digits removed (`Main Street 12a` gives `Main Street a`).
Returns
city()
Section titled “city()”listAddress.city()→string Returns the city column of the current address, trimmed.
Returns
scramble()
Section titled “scramble()”listAddress.scramble()→self Forgets the current address so the next part function picks a new random one. Returns the address helper itself, so it can be chained: `addresses.scramble().city()`.
Returns