Cómo dividir cuerdas en Golang

Golang string Fields () es una función incorporada para dividir una cadena en subcadenas eliminando cualquier carácter de espacio en blanco, incluidas las nuevas líneas. La función Fields () acepta una cadena como argumento y devuelve una matriz.

Si desea usar la función Fields (), primero debe ingresar la función string  y luego usar la función string.Fields ().

Sintaxis

func Fields(s string) []string

Parámetro

La función Fields () toma una cadena como parámetro, necesitamos dividir la cadena.

Ejemplo de función Fields ()

Consulte el siguiente código.

// hello.go

package main

import (
    "fmt"
    "strings"
)

func main() {
    quibi := " TheStranger 50StatesOfFright    MostDangerousGame  "
    series := strings.Fields(quibi)

    // Display all fields, first field and count.
    fmt.Println(series)
    fmt.Println(series[0])
    fmt.Println(len(series))
}

Producción

go run hello.go
[TheStranger 50StatesOfFright MostDangerousGame]
TheStranger
3

En el código anterior, hemos definido una cadena llamada  quibi, que  tiene tres campos y un espacio.

La función string.Fields () elimina espacios y convierte la cadena en una matriz.

Luego imprimimos la cadena de la matriz, su primer elemento y la longitud de la matriz.

Conclusión

En las cadenas de Golang, se le permite dividir una cadena en porciones usando la función string.Fields () .

La función Fields () divide la cadena alrededor de cada instancia de caracteres de espacio en blanco consecutivos en una matriz.

What is GEEK

Buddha Community

Hire Dedicated Golang Developers | Golang Web Development Company

Does your business need a robust system across large-scale network servers then developing your app with a Golang programming language is the way to go. Golang is generally used for the development of highly secured, High Speed and High Modularity apps such as a FinTech Industry.

Want to develop a Highly secured app for your business?

Then hire a dedicated Golang developer from WebClues Infotech that are highly skilled in carrying out the work in a timely and qualitative output. With WebClues Infotech you get the assurance that we know what are the customers’ expectations and how to deliver on them on time.

Get your desired Golang Developer based on your project requirement!!

Share your requirements here https://www.webcluesinfotech.com/contact-us/

Book Free Interview with Golang developer: https://bit.ly/3dDShFg

#hire golang developer #hire go language developer #dedicated golang app developers #golang web development company #hire golang developers india #hire expert golang developers

Golang Web Development:Th Best Programming Language in 2020

https://www.mobinius.com/blogs/golang-web-development-company

#golang web development #golang-app-development-company #golang-development-solutions #hire-golang-developers #golang-development-services

Ajay Kapoor

1624960485

Golang vs. Node.JS: Who Trumps the Battle of Backend Frameworks?

Full blog here

The backend of your application is truly the essential part of your product. No matter how much you appreciate the design, the application’s success lies in its backend. A scalable backend that effectively implements the required business logic is the primary goal of programmers.

Therefore, it is crucial to choose the most powerful and scalable technology. There are plenty of languages ​​in the market that can form the backend of any application, Node.js and Golang are the two most popular technologies among them.

They are real and developed languages ​​that have recently been used in various outstanding projects. Golang is an open-source programming language, whereas Node.js is an open-source server framework. They both are gaining popularity for various reasons.

According to a development stat, it is observed that almost 50% out of 58,543 respondents use Node.js as their preferred app development tool.

Golang, on the other hand, has overtaken other programming languages in the application development market and has gained huge recognition over the past few years.

But, which backend framework is best for you? In this article, I’ll make a healthy comparison of two of Google’s most popular backend development tools based on several essential features and various other factors.

Golang developers for hire

#best backend frameworks #node or golang #golang or nodejs #nodejs vs golang #golang vs nodejs #top backend frameworks

Fannie  Zemlak

Fannie Zemlak

1599732000

“Go Has Indeed Become The Language Of Cloud Infrastructure“ - Rob Pike

Introduction

We spoke to Rob Pike, the co-author of the Go programming language, about a career spanning four decades, the evolution of Go over the last ten years, and into the future.

The Interview

Evrone: Unlike many developers today, you started your career decades ago at Bell Labs. What’s been the biggest change in the way we develop software that you can think of, given your rare perspective?

**Rob: **The scale is much bigger today. Not just of the computers and the network, but the programs themselves. All of Unix version 6 (circa 1975) fits comfortably on a single RK05 disk pack, which has just over 2MB of storage, with lots of room left over for user software. And that was a fine computing environment, or at least seemed like one at the time. Although I can, of course, explain much of the growth, it is astonishing and perhaps not all of it is justified.

#golang #golang-api #golang-tools #golang-website #rob-pike #interview-transcript-go #latest-tech-stories #cloud-infrastructure-and-go

Road to Golang pro — Pointer & Functions

A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.

We talked about flow controls and loops in the last part of the tutorial. In this one, we will cover pointers and functions. After finishing the first 4 parts of Road to Go Pro, you are well equipped to start writing scripts or console applications using Go.

Pointers

Image for post

Photo by Nathalie SPEHNER on Unsplash

If you have used C or C++, you already know what’s a pointer. However, in the most popular programming languages like Java, C#, Javascript, Python, etc. there’s no explicit syntax to represent pointers. I had no idea what it is when I first heard of this name.

In short, a pointer holds the underlying memory address of a value. Whoa, hold on, memory address? Isn’t Go a high-level programming language?

When do we even need to know about the memory addresses of variables?

That’s a good question but before exploring the answer, we need to take a quick detour. Let’s see how to declare pointers and how to use them in functions. Once we have covered these, it will be easier for you to understand the reasoning and examples below. So hang in there.

Declaring pointers

Whenever we declare a variable in Go, the compiler allocates a segment of memory to store it. The value of that variable is stored there until it is recycled by the garbage collector.

Pointers are composite data types. We form a pointer type by adding an * in front of the data type it points to. For instance, *string represents the type of a pointer pointing to a string-type variable.

To get the pointer value of an existing variable, we need to add an & in front of the variable.

#golang #go #golang-tutorial #golang-development