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

How to determine whether a string is empty in golang

尚
Original
2020-01-09 16:21:18 8943browse

How to determine whether a string is empty in golang

How to determine whether a string is empty in golang:

if len(str) == 0{ }

Or use the following method to determine:

if str == "" { }

Use the following method Test:

func Benchmark_Fun(b *testing.B) { ....... }

For more golang knowledge, please pay attention to thegolang tutorialcolumn on 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