stringx

package
v0.0.0-...-3f1cc49 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Copyright © 2023 Xu Wu <ixw1991@126.com> Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SkipFirstAndLastParts

func SkipFirstAndLastParts(s string) string

SkipFirstAndLastParts 去掉输入字符串的第一部分和最后一部分, 如果只有一个 '-',则只去掉第一部分。 例如,"hello-world-golang" 转换为 "world", "hello-world" 转换为 "world", "hello" 保持不变。

func SkipFirstPart

func SkipFirstPart(s string) string

SkipFirstPart 函数用于跳过以 "-" 分隔的字符串的第一部分 如果输入的字符串s包含 "-",例如:"hello-world-android",函数会跳过第一个 "-" 之前的部分(即"hello"),并返回剩余部分转换为驼峰命名的字符串,如:"worldAndroid" 如果输入的字符串s不包含 "-",函数会原样返回输入的字符串s

func SkipLastPart

func SkipLastPart(s string) string

SkipLastPart 函数跳过以 '-' 分隔的字符串的最后一部分 例如,"hello-world-android" 转换为 "hello-world" 如果字符串没有 '-',例如 "tope",则返回原字符串

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice 函数检查字符串 a 是否在列表 list 中

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase 函数将一个由'-'连接的字符串转换为 camelCase 例如,"hello-world" 转换为 "helloWorld"

func ToPascalCase

func ToPascalCase(str string) string

ToPascalCase 函数将一个由'-'连接的字符串转换为 PascalCase 例如,"hello-world" 转换为 "HelloWorld"

Types

This section is empty.

Jump to

Keyboard shortcuts

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