エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント1件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
sliceからN番目の要素を削除する - Qiita
package main import ( "fmt" ) func main() { t := []string{"0番目","1番目","2番目","3番目","4番目"... package main import ( "fmt" ) func main() { t := []string{"0番目","1番目","2番目","3番目","4番目"} fmt.Println(t) n := 2 fmt.Printf("%d番目を削除\n", n) t = unset(t, n) fmt.Println(t) } func unset(s []string, i int) []string { if i >= len(s) { return s } return append(s[:i], s[i+1:]...) } Register as a new user and use Qiita more conveniently You get articles that match your needsYou can efficiently read back us
2018/05/01 リンク