In Swift, hashValue
is a string property, used to return the hash value of a string
value.
string.hashValue
It returns the hash value of string
.
// create some stringslet name = "Theodore"let language = "Swift"let emptyString = ""// get hashValue propertylet debugDesc1 = name.hashValuelet debugDesc2 = language.hashValuelet debugDesc3 = emptyString.hashValue// print resultsprint(debugDesc1) // "Theodore"print(debugDesc2) // "Swift"print(debugDesc3) // ""
string
values.hashValue
property to get the hash values of the strings, and save the results.