Golang os.IsPathSeparator() function example
package os
Golang os.IsPathSeparator() function usage example.
package main
import (
"fmt"
"os"
)
func main() {
path := "./testdir"
fmt.Printf("Is %v a path separator? : %v \n", string(path[0]), os.IsPathSeparator(path[0]))
fmt.Printf("Is %v a path separator? : %v \n", string(path[1]), os.IsPathSeparator(path[1]))
fmt.Printf("Is %v a path separator? : %v \n", string(path[2]), os.IsPathSeparator(path[2]))
fmt.Printf("Is %v a path separator? : %v \n", string(path[3]), os.IsPathSeparator(path[3]))
}
Is . a path separator? : false
Is / a path separator? : true
Is t a path separator? : false
Is e a path separator? : false
Reference :
Advertisement
Something interesting
Tutorials
+22.2k Golang : Convert seconds to minutes and remainder seconds
+30.9k Golang : Interpolating or substituting variables in string examples
+9.2k Golang : Create and shuffle deck of cards example
+4.3k Javascript : How to show different content with noscript?
+7.5k Golang : Handling Yes No Quit query input
+6.2k Golang : Calculate US Dollar Index (DXY)
+11.6k Golang : Simple file scaning and remove virus example
+16.5k Golang : Execute terminal command to remote machine example
+16.6k Golang : Generate QR codes for Google Authenticator App and fix "Cannot interpret QR code" error
+5.6k Swift : Get substring with rangeOfString() function example
+17.7k Golang : [json: cannot unmarshal object into Go value of type]
+14.1k Golang : Check if a file exist or not