How to determine whether a string is empty in golang

王林
Release: 2020-02-26 16:54:23
Original
6424 people have browsed it

How to determine whether a string is empty in golang

Method to determine whether a string is empty in golang:

if len(str) == 0{

}
Copy after login

Recommended learning: go basic tutorial

Or use The following method is used to judge:

if str == "" {

}
Copy after login

Test method:

func Benchmark_Fun(b *testing.B) {

  .......

}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template