/**
 * Given a string of geographical coordinates separated by commas, create a list of
 * pairs containing the latitude and longitude for each coordinate.
 *
 * Example:
 * createTupleFromString("40.7128° N, 74.0060° W, 34.0522° N, 118.2437° W")
 * Output: [(40.7128, -74.0060), (34.0522, -118.2437)]
 */
fun createTupleFromString(string: String): List<Pair<Double, Double>> {

    // Remove any unwanted characters and split the string into individual coordinate pairs
    val coordinates = string.replace("°", "").trim().split(",")

    // Initialize an empty list to store the latitude and longitude pairs
    val tuples = mutableListOf<Pair<Double, Double>>()

    // Iterate over each coordinate pair
    for (i in 0 until coordinates.size step 2) {
        // Extract latitude and longitude values from the coordinate pair
        val (latitude, longitude) = coordinates.subList(i, i + 2).map { it.trim().toDouble() }
        tuples.add(Pair(latitude, -longitude)) // Reverse the sign of longitude for geographers
    }

    return tuples
}
/**
 * Given a string of geographical coordinates separated by commas, create a list of
 * pairs containing the latitude and longitude for each coordinate.
 *
 * Example:
 * createTupleFromString("40.7128° N, 74.0060° W, 34.0522° N, 118.2437° W")
 * Output: [(40.7128, -74.0060), (34.0522, -118.2437)]
 */
fun createTupleFromString(string: String): List<Pair<Double, Double>> {
/**
 * Given a string of geographical coordinates separated by commas, create a list of
 * pairs containing the latitude and longitude for each coordinate.
 *
 * Example:
 * createTupleFromString("40.7128° N, 74.0060° W, 34.0522° N, 118.2437° W")
 * Output: [(40.7128, -74.0060), (34.0522, -118.2437)]
 */
fun createTupleFromString(string: String): List<Pair<Double, Double>> {

    // Remove any unwanted characters and split the string into individual coordinate pairs
    val coordinates = string.replace("°", "").trim().split(",")

    // Initialize an empty list to store the latitude and longitude pairs
    val tuples = mutableListOf<Pair<Double, Double>>()

    // Iterate over each coordinate pair
    for (i in 0 until coordinates.size step 2) {
        // Extract latitude and longitude values from the coordinate pair
        val (latitude, longitude) = coordinates.subList(i, i + 2).map { it.trim().toDouble() }
        tuples.add(Pair(latitude, -longitude)) // Reverse the sign of longitude for geographers
    }

    return tuples
}