슬라이스에서 문자열 모든

코드 예제

2
0

모든 슬라이스 문자열

First of all, you should really read about strings, bytes and runes in Go.

And here is how you can achieve what you want: Go playground (I was not able to properly paste arabic symbols, but if Chinese works, arabic should work too).

    s := "abcdefghijklmnop" 
    fmt.Println(s[2:9]) 

    s = "something which is display"
    fmt.Println(string([]rune(s)[2:9]))
0
0

의 모든 변환 슬라이스 문자열

Golang program that converts slice to string

package main

import (
    "fmt"
    "strings"
)

func main() {
    // Slice of 3 strings.
    values := []string{"fish", "chicken", "lettuce"}
    // Convert slice into a string.
    result := strings.Join(values, ",");
    fmt.Println(result)
}

Output

fish,chicken,lettuce

비슷한 페이지

예제가있는 유사한 페이지

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................