github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/path/filepath/example_test.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package filepath_test 6 7 import ( 8 "fmt" 9 "path/filepath" 10 ) 11 12 func ExampleExt() { 13 fmt.Printf("No dots: %q\n", filepath.Ext("index")) 14 fmt.Printf("One dot: %q\n", filepath.Ext("index.js")) 15 fmt.Printf("Two dots: %q\n", filepath.Ext("main.test.js")) 16 // Output: 17 // No dots: "" 18 // One dot: ".js" 19 // Two dots: ".js" 20 }