Skip to content
/ GoLearn Public

生命的闪耀不坚持到底怎能看到,与其苟延残喘不如纵情燃烧吧。

Notifications You must be signed in to change notification settings

RiKaCC/GoLearn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-demo

string package usage

string reverse

str := "reverse string"
ret := StringReverse(str) 
fmt.Println(ret)  //"gnirts esrever"

string join

//there two function for use
//StringJoin and StringJoinMore

s1 := "hello"
s2 := "world"

//you can use the character which you want join between the strings, using BetweenWith("character")
ret := StringJoin(s1, s2).BetweenWith("") 
fmt.Println(ret)  //"helloworld"

ret := StringJoin(s1, s2).BetweenWith(" ") 
fmt.Println(ret)  //"hello world"

ret := StringJoin(s1, s2).BetweenWith("+") 
fmt.Println(ret)  //"hello+world"

//you also can join more strings like this
StringJoin(s1, s2, s3, s4, ....).BetweenWith("+") 

//you can use array also
str := []string{"hello","world","every"}
ret := StringJoinMore(str).BetweenWith("+")
fmt.Println(ret) //"hello+world"

SubString

str := "Monday"
s, _ := SubString(str).Start(0).End(4)
fmt.Println(s) // "Monda"

s, _ := SubString(str).Start(2).End(3)
fmt.Println(s) // "nd"

s, _ := SubString(str).OnlyStart(2)
fmt.Println(s) // "nday"

About

生命的闪耀不坚持到底怎能看到,与其苟延残喘不如纵情燃烧吧。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages