i store different count of string data pairs in format:
string a[n][2]{ {"1","2"}, {"3","4"}, {"5","6"} {... }};
i add new pair using append methode or similar... possible , nice handle 2d array or should use dictionaire?? , how implement that? thanks!
you potentially use array of tuples solve this:
typealias stringpair = (string, string) var mystrings = [stringpair]() mystrings.append(stringpair("1", "2"))
edit: search string pair, do:
var doesitcontain1 = mystrings.contains { $0.0 == "1" }
you change type alias use names:
typealias stringpair = (string1: string, string2: string)
and filter with:
var doesitcontain1 = mystrings.contains { $0.string1 == "1" }
edit 2: sort:
var sorted = mystrings.sort { return $0.string1 < $1.string1 }
Comments
Post a Comment