aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/stdlib.go
blob: b380e80398ff66ce2025ec5c8b8fa79c99f48f14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"
	"math/rand"
	"os"
	"strings"
)

func main() {
	// package os, fmt
	fmt.Println("stdin: ", os.Stdin.Name())
	fmt.Println("stdout:", os.Stdout.Name())
	fmt.Println("stderr:", os.Stderr.Name())

	// package math/rand
	fmt.Println("pseudorandom number:", rand.Int31())

	// package strings
	fmt.Println("strings.IndexByte:", strings.IndexByte("asdf", 'd'))
	fmt.Println("strings.Replace:", strings.Replace("An example string", " ", "-", -1))
}