Label: GoString

A Go string (gostring) is a sequence of bytes used to store text in the Go programming language. Strings in Go are immutable, which means their contents cannot be changed after creation. The language stores string data in UTF-8 format by default. A string can contain plain ASCII text or Unicode characters. Developers can create strings using double quotes or raw string literals with backticks. Go provides many built-in functions and packages for string processing. Operations such as concatenation, searching, splitting, and formatting are commonly used in Go applications. Because strings are immutable, modifying text usually creates a new string object. Efficient string handling is important for networking, web services, and data processing software.

Understanding Go strings is essential for text processing, Unicode handling, and application development in Go.

String transfer from a function in GO to a code in C without memory allocation (Part 2)

We were discussing a possibility of string transfer without memory allocation in the previous article. Attempts to use this method in the real projects revealed that there are cases when this method is not applicable. Everything is working just fine if a string object is constructed from a static string constant or by means of

String transfer from a function in GO to a code on C without memory allocation (Part 1)

CGO documentation illuminates string transfer issue rather poorly. They only mention that C.CString() function should be used in order to convert a string object into a pointer to a buffer with a zero-terminated string – char*, which is coherent for the C code. This is great; however, a memory block is being allocated during this procedure