gostrings

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EMPTY 字符常量:空字符串 {@code ""}
	EMPTY = ""
	// SPACE 字符常量:空格符 {@code " "}
	SPACE = " "
	// TAB 字符常量:制表符 {@code "\t"}
	TAB = "	"
	// DOT 字符常量:点 {@code "."}
	DOT = "."
	// SLASH 字符常量:斜杠 {@code "/"}
	SLASH = "/"
	// BACKSLASH 字符常量:反斜杠 {@code "\\"}
	BACKSLASH = "\\"
	// CR 字符常量:回车符 {@code "\r"}
	CR = "\r"
	// LF 字符常量:换行符 {@code "\n"}
	LF = "\n"
	// DASHED 字符常量:减号(连接符) {@code "-"}
	DASHED = "-"
	// UNDERLINE 字符常量:下划线 {@code "_"}
	UNDERLINE = "_"
	// COMMA 字符常量:逗号 {@code ","}
	COMMA = ","
	// DELIM_START 字符常量:花括号(左) <code>"{"</code>
	DELIM_START = "{"
	// DELIM_END 字符常量:花括号(右) <code>"}"</code>
	DELIM_END = "}"
	// BRACKET_START 字符常量:中括号(左) {@code "["}
	BRACKET_START = "["
	// BRACKET_END 字符常量:中括号(右) {@code "]"}
	BRACKET_END = "]"
	// DOUBLE_QUOTES 字符常量:双引号 {@code """}
	DOUBLE_QUOTES = "\""
	// SINGLE_QUOTE 字符常量:单引号 {@code "\""}
	SINGLE_QUOTE = "\""
	// AMP 字符常量:与 {@code "&"}
	AMP = "&"
	// COLON 字符常量:冒号 {@code ":"}
	COLON = ":"
	// AT 字符常量:艾特 <code>"@"</code>
	AT = "@"
	// LETTERS 字符常量:字母和数字 {@code "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"}
	LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)

Variables

This section is empty.

Functions

func EndWith added in v0.2.5

func EndWith(str, suffix string) bool

EndWith 判断字符串是否以指定后缀结尾

func LinesToMultiLines added in v0.2.5

func LinesToMultiLines(lines string) []string

LinesToMultiLines 将单行字符串转换为多行字符串 lines 单行字符串

func MultiLinesToLines

func MultiLinesToLines(lines []string) string

MultiLinesToLines 将多行字符串转换为单行字符串 lines 多行字符串

func RandomStr added in v0.2.0

func RandomStr(count int) string

RandomStr 返回一个指定长度的随机字符串 count 随机字符串的长度

func RandomStrings added in v0.2.0

func RandomStrings(source string, count int) string

RandomStrings 返回一个指定长度的随机字符串 source 随机字符串的来源 count 随机字符串的长度

func RemoveAll added in v0.2.5

func RemoveAll(str, before, after string) string

RemoveAll removes all occurrences of before and after from str

func RemoveFirst added in v0.2.5

func RemoveFirst(str, before, after string) string

RemoveFirst removes the first occurrence of before and after from str

func RemoveLast added in v0.2.5

func RemoveLast(str, before, after string) string

func ReplacePlaceholders added in v0.2.0

func ReplacePlaceholders(value string, parameters map[string]string) string

ReplacePlaceholders 替换占位符 value 待替换的字符串 parameters 占位符参数

func ReplacePlaceholdersTokenizer added in v0.2.0

func ReplacePlaceholdersTokenizer(value string, tokenizer *Tokenizer, fun func(name string) string) string

ReplacePlaceholdersTokenizer 替换占位符 value 待替换的字符串 tokenizer 占位符解析器 fun 解析函数

func StartWith added in v0.2.5

func StartWith(str, prefix string) bool

StartWith 判断字符串是否以指定前缀开头

func SubAfter

func SubAfter(str, before string) string

SubAfter 截取分隔字符串之后的字符串,不包括分隔字符串。 如果给定的字符串为空串(""),返回原字符串。 如果分隔字符串为空串(""),则返回空串。 如果分隔字符串未找到,返回空串。

func SubBefore

func SubBefore(str, after string) string

SubBefore 截取分隔字符串之前的字符串,不包括分隔字符串。 如果给定的字符串为空串(""),返回原字符串。 如果分隔字符串为空串(""),则返回空串。 如果分隔字符串未找到,返回空串。

func SubBetween

func SubBetween(str, before, after string) string

SubBetween 截取指定字符串中间部分,不包括标识字符串

Types

type Tokenizer added in v0.2.0

type Tokenizer struct {
	Prefix string
	Subbix string
	DefVal string
}

Tokenizer 占位符解析器

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL