Home >Backend Development >Golang >How to determine whether a string is empty in golang

How to determine whether a string is empty in golang

王林
王林Original
2020-02-17 10:58:576463browse

How to determine whether a string is empty in golang

Method to determine whether a string is empty in golang:

if len(str) == 0{

}

Recommended learning: go basic tutorial

Or use The following method is used to judge:

if str == "" {

}

Test method:

func Benchmark_Fun(b *testing.B) {

  .......

}

For more related content, please pay attention to the Programming Tutorial column of the PHP Chinese website!

The above is the detailed content of How to determine whether a string is empty in golang. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn