Created
October 21, 2019 21:44
-
-
Save jeffotoni/160f670193fd5546964c001d61319656 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func Substr(value string, leni, lenf int) string { | |
if len(value) < leni { | |
return "" | |
} | |
lenx := len(value) // max of text | |
leny := lenf // amount of character | |
if lenx < lenf { // amount of character | |
leny = lenx | |
} | |
return value[leni:leny] | |
} | |
func main() { | |
strIndex:="/home/netcatc/diretorio1/x3334343x34334343/testef2/guilherme/f2-guilherme-2/folder1/folder2-rename2" | |
final := len(strIndex)-1 | |
posi := strings.Index(strIndex, "/x3334343x34334343/") | |
fmt.Println(Substr(strIndex,posi, final)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment