
创新互联专注于网站建设,为客户提供成都做网站、成都网站建设、网页设计开发服务,多年建网站服务经验,各类网站都可以开发,成都品牌网站建设,公司官网,公司展示网站,网站设计,建网站费用,建网站多少钱,价格优惠,收费合理。
Levenshtein计算两个字符串之间的Levenshtein距离。 Levenshtein(str1, str2 string, costIns, costRep, costDel int) intfunc ExampleLevenshtein() {
	var (
		str1    = "Hello World"
		str2    = "hallo World"
		costIns = 1
		costRep = 1
		costDel = 1
		result  = gstr.Levenshtein(str1, str2, costIns, costRep, costDel)
	)
	fmt.Println(result)
	// Output:
	// 2
}SimilarText计算两个字符串之间的相似度。   SimilarText(first, second string, percent *float64) intfunc ExampleSimilarText() {
	var (
		first   = `AaBbCcDd`
		second  = `ad`
		percent = 0.80
		result  = gstr.SimilarText(first, second, &percent)
	)
	fmt.Println(result)
	// Output:
	// 2
}Soundex用于计算字符串的Soundex键。   Soundex(str string) stringfunc ExampleSoundex() {
	var (
		str1    = `Hello`
		str2    = `Hallo`
		result1 = gstr.Soundex(str1)
		result2 = gstr.Soundex(str2)
	)
	fmt.Println(result1, result2)
	// Output:
	// H400 H400
}            
                本文名称:创新互联GoFrame教程:GoFramegstr-相似计算
                
                本文网址:http://www.csdahua.cn/qtweb/news23/208723.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网