
十载的建德网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站的优势是能够根据用户设备显示端的尺寸不同,自动调整建德建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“建德网站设计”,“建德网站推广”以来,每个客户项目都认真落实执行。
Pos返回needle在haystack中第一次出现的位置,区分大小写。 如果没有找到,则返回-1。   Pos(haystack, needle string, startOffset ...int) int
func ExamplePos() {
	var (
		haystack = `Hello World`
		needle   = `World`
		result   = gstr.Pos(haystack, needle)
	)
	fmt.Println(result)
	// Output:
	// 6
}
PosRune的作用于函数Pos相似,但支持haystack和needle为unicode字符串。   PosRune(haystack, needle string, startOffset ...int) int
func ExamplePosRune() {
	var (
		haystack = `GOFrame是一款模块化、高性能、企业级的Go基础开发框架`
		needle   = `Go`
		posI     = gstr.PosRune(haystack, needle)
		posR     = gstr.PosRRune(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 0
	// 22
}
PosI返回needle在haystack中第一次出现的位置,不区分大小写。 如果没有找到,则返回-1。   PosI(haystack, needle string, startOffset ...int) int
func ExamplePosI() {
	var (
		haystack = `GoFrame is very, very easy to use`
		needle   = `very`
		posI     = gstr.PosI(haystack, needle)
		posR     = gstr.PosR(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 11
	// 17
}
PosRuneI的作用于函数PosI相似,但支持haystack和needle为unicode字符串。   PosIRune(haystack, needle string, startOffset ...int) int
func ExamplePosIRune() {
	{
		var (
			haystack    = `GoFrame是一款模块化、高性能、企业级的Go基础开发框架`
			needle      = `高性能`
			startOffset = 10
			result      = gstr.PosIRune(haystack, needle, startOffset)
		)
		fmt.Println(result)
	}
	{
		var (
			haystack    = `GoFrame是一款模块化、高性能、企业级的Go基础开发框架`
			needle      = `高性能`
			startOffset = 30
			result      = gstr.PosIRune(haystack, needle, startOffset)
		)
		fmt.Println(result)
	}
	// Output:
	// 14
	// -1
}
PosR返回needle在haystack中最后一次出现的位置,区分大小写。 如果没有找到,则返回-1。   PosR(haystack, needle string, startOffset ...int) int
func ExamplePosR() {
	var (
		haystack = `goframe is very, very easy to use`
		needle   = `very`
		posI     = gstr.PosI(haystack, needle)
		posR     = gstr.PosR(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 11
	// 17
}
PosRuneR的作用于函数PosR相似,但支持haystack和needle为unicode字符串。   PosRRune(haystack, needle string, startOffset ...int) int
func ExamplePosRRune() {
	var (
		haystack = `GoFrame是一款模块化、高性能、企业级的Go基础开发框架`
		needle   = `Go`
		posI     = gstr.PosIRune(haystack, needle)
		posR     = gstr.PosRRune(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 0
	// 22
}
PosRI返回needle在haystack中最后一次出现的位置,不区分大小写。 如果没有找到,则返回-1。   PosRI(haystack, needle string, startOffset ...int) int
func ExamplePosRI() {
	var (
		haystack = `goframe is very, very easy to use`
		needle   = `VERY`
		posI     = gstr.PosI(haystack, needle)
		posR     = gstr.PosRI(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 11
	// 17
}
PosRIRune的作用于函数PosRI相似,但支持haystack和needle为unicode字符串。   PosRIRune(haystack, needle string, startOffset ...int) int
func ExamplePosRIRune() {
	var (
		haystack = `GoFrame是一款模块化、高性能、企业级的Go基础开发框架`
		needle   = `GO`
		posI     = gstr.PosIRune(haystack, needle)
		posR     = gstr.PosRIRune(haystack, needle)
	)
	fmt.Println(posI)
	fmt.Println(posR)
	// Output:
	// 0
	// 22
}
            
                文章标题:创新互联GoFrame教程:GoFramegstr-位置查找
                
                网页地址:http://www.csdahua.cn/qtweb/news32/41532.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网