From a2b21f6c3355b132c67abd2b55c1bb319cc3ed42 Mon Sep 17 00:00:00 2001 From: "Rick.Chan" Date: Thu, 8 Dec 2022 00:58:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E6=A0=87=E9=A2=98,=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9B=AE=E5=BD=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rick.Chan --- .../Language/Go/Basic/Golang_字符串操作.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Software/Development/Language/Go/Basic/Golang_字符串操作.md b/Software/Development/Language/Go/Basic/Golang_字符串操作.md index 22e9fd5..5690853 100644 --- a/Software/Development/Language/Go/Basic/Golang_字符串操作.md +++ b/Software/Development/Language/Go/Basic/Golang_字符串操作.md @@ -1,6 +1,14 @@ # Golang 字符串操作 -## 1.分割/拼接操作 +- [Golang 字符串操作](#golang-字符串操作) + - [1. 分割/拼接操作](#1-分割拼接操作) + - [2. 字符串和其他类型转换](#2-字符串和其他类型转换) + - [3. 字符串查找](#3-字符串查找) + - [4. 剔除字符](#4-剔除字符) + - [5. 字符串长度](#5-字符串长度) + + +## 1. 分割/拼接操作 ```go // 1. 以 "," 对字符串分割 @@ -13,7 +21,7 @@ s=strings.Join(parts,"-") fmt.Println(s) ``` -## 2.字符串和其他类型转换 +## 2. 字符串和其他类型转换 ```go // 整形转字符串 @@ -68,7 +76,7 @@ strings.TrimPrefix("+-+-He+-llo+-+-", "+-") // 仅剔除一组完全匹配 strings.TrimSuffix("+-+-He+-llo+-+-", "+") // 仅剔除一组完全匹配的后导符,return "+-+-He+-llo+-" ``` -## 4.字符串长度 +## 5. 字符串长度 ```go fmt.Println(len("Hello"))