Tue, 01 Jan 2019

Create repository

What is a repository? You can simply understand it as a directory. All files in this directory can be managed by Git. Git can track the modification and deletio...

Wed, 20 Jan 2021

Markdown insert table syntax

We know that by default, Markdown inserts the table, the contents of the cells are left-aligned by default; the contents of the header cells will always be cent...

Wed, 20 Jan 2021

Installing Git

The earliest Git was developed on Linux. For a long time, Git can only be run on Linux and Unix systems. However, slowly someone ported it to Windows. Now, Git ...

Wed, 20 Jan 2021

Introduction to Git

What is Git? Git is currently the world's most advanced distributed version control system (no one). What are the characteristics of Git? Simply put: high-end a...

Wed, 20 Jan 2021

Git tutorial

Why write this tutorial? Because in the process of learning Git, I bought books, and also Googled a bunch of Git-related articles and tutorials on the Internet,...

Wed, 20 Jan 2021

Determine whether a string contains another string in golang

``` strings.Contains(s, substr string) bool ``` For example ``` package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.Contains("seafood", "f...

Wed, 20 Jan 2021

Get the length of a string in go

strings.Count(s, sep string) int Get the number of occurrences of parameter sep in parameter s. If the parameter sep is empty, the length of the parameter s is ...

Wed, 20 Jan 2021

String separation in Go

strings.Split strings.Split(s, sep string) []string Use the parameter sep as the delimiting string to separate the parameter s, and return a string array. For e...

Wed, 20 Jan 2021

String replacement in Go

syntax strings.Replace(s, old, new string, n int) string The parameter n indicates the number of replacements, less than 0 indicates unlimited times. For exampl...

Wed, 20 Jan 2021

Convert strings to lowercase letters in Go

func ToLower strings.ToLower(s string) string ToLower returns a copy of the string s where all Unicode letters are mapped to uppercase letters. For example pack...

Wed, 20 Jan 2021

Convert strings to uppercase letters in Go

func ToUpper strings.ToUpper(s string) string ToLower returns a copy of the string s where all Unicode letters are mapped to uppercase letters. For example pack...

Wed, 20 Jan 2021

Remove spaces on both sides of a string in Go

func Trim strings.Trim(s string, cutset string) string Trim returns a part of a string s, which deletes all the first and last characters contained in the cutse...

Wed, 20 Jan 2021

Get the position of a string in another string in Go

func Index strings.Index(s, sep string) int Index returns the index of the first instance of sep in s; if sep does not exist in s, it returns -1. For example pa...

Wed, 20 Jan 2021

Compare two strings for equality in go

Three common methods of golang string comparison Self-built method "==", case sensitive, the easiest way Compare function, case sensitive Compare whether the UT...

Wed, 20 Jan 2021

Ternary expressions in Go

Go language clearly does not support ternary expressions, here is the relevant discussion: https://groups.google.com/d/msg/golang-nuts/dbyqx_LGUxM/tLFFSXSfOdQJ ...