String operation golang

main Package 

Import (
"bytes"
"FMT"
"strings"
)

/ *
string: String golang language, source code is utf-8 format string in the language golang bytes actually read-only sections
/ / string literal original string literal string `` wrap, the original string literal is a string literal and explanatory and are (is \ n \ r such explanatory)
string operation, call this package main strings

* /

FUNC main () {
var // buffer for bytes.Buffer states by the string concatenation buffer
for I: = 0; I <= 100; I ++ {
that Buffer.writeString ( "Z")
}
fmt.Println (buffer.String ())
fmt.Println (strings.ToLower ( "WOSHI")) // converted to lowercase
//fmt.Println(strings.Index("surface","face ")) // Find substring, returns the index of the first sub-string, if none -1
//fmt.Println (strings.TrimSpace ( "Surfac E")) // delete spaces both sides
// string literal with the original string literal string `` wrap, the original string literal is a string literal and explanatory and are (is \ n \ r such explanatory)
S: = ' My World the this
, But I Love you
you Love Me `?
fmt.Println (S)
EE: =" Hello "
fmt.Printf ("% Q \ n-", EE [0]) // H printed
fmt.Printf ( "% b \ n", ee [0]) // byte is not print out the characters h, h byte Unicode standard 1101000

}

Guess you like

Origin www.cnblogs.com/iifeng/p/11488859.html