GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Why Go arrow_drop_down
  • Case Studies
  • Use Cases
  • Security
  • Learn
  • Go Spec
  • Go User Manual
  • Standard library
  • Release Notes
  • Effective Go
  • Packages
  • Recorded Talks
  • Meetups open_in_new
  • Conferences open_in_new

This view

  • Original page
  • New address

GeezerVison is showing go.dev — - The Go Programming Language

Source file src/strings/clone.go

     1  // Copyright 2021 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 strings
     6  
     7  import (
     8  	"internal/stringslite"
     9  )
    10  
    11  // Clone returns a fresh copy of s.
    12  // It guarantees to make a copy of s into a new allocation,
    13  // which can be important when retaining only a small substring
    14  // of a much larger string. Using Clone can help such programs
    15  // use less memory. Of course, since using Clone makes a copy,
    16  // overuse of Clone can make programs use more memory.
    17  // Clone should typically be used only rarely, and only when
    18  // profiling indicates that it is needed.
    19  // For strings of length zero the string "" will be returned
    20  // and no allocation is made.
    21  func Clone(s string) string {
    22  	return stringslite.Clone(s)
    23  }
    24  

View as plain text

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.