Created
June 24, 2020 03:03
-
-
Save asyncins/3db7397c08f81447bde6454be2cc3caa to your computer and use it in GitHub Desktop.
[Golang 两个数组是否完全相等]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 判断两个数组是否相同 */ | |
func ArrayEqual(a, b []string) bool { | |
if (a == nil) != (b == nil) { | |
return false | |
} | |
if len(a) != len(b) { | |
return false | |
} | |
for key, val := range a { | |
if val != b[key] { | |
return false | |
} | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment