dashstr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dashstr

字符串处理相关函数

String handling correlation function

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelString

func CamelString(s string) string

@蛇形转驼峰 Editor robotyang at 2023

# 蛇形转驼峰
@description xx-yy to XxYx  xx-y-y to XxYY
@param s要转换的字符串
@Return string

func CamelStringStrike

func CamelStringStrike(s string) string

@蛇形转驼峰 Editor robotyang at 2023

# 蛇形转驼峰
@description xx_yy to XxYx  xx_y_y to XxYY
@param s要转换的字符串
@Return string

func IsAMMobile

func IsAMMobile(tel string) bool

IsAMMobile

IsAMMobile 判断是否中国澳门号码

@Tips 建议先使用 TrimBlank 函数过滤特殊字符,再来调用这个方法

func IsCapitalLetter

func IsCapitalLetter(str string) bool

IsCapitalLetter @Editor robotyang at 2023

IsCapitalLetter 判断是否为 纯大写字母

@Param str 待判断的字符

func IsDigit

func IsDigit(str string) bool

IsDigit @Editor robotyang at 2023

IsDigit 判断是否为 纯整数

@Param str 待判断的字符

func IsDigitLetter

func IsDigitLetter(str string) bool

IsDigitLetter @Editor robotyang at 2023

IsDigitLetter 判断是否为 整数+字母

@Param str 待判断的字符

func IsHATMobile

func IsHATMobile(tel string) bool

IsHATMobile

IsHATMobile 是否港澳台号码

func IsHKMobile

func IsHKMobile(tel string) bool

IsHKMobile

IsHKMobile 判断是否中国香港号码(为区号00852开头,可选加-,再加8位数字)

@Tips 建议先使用 TrimBlank 函数过滤特殊字符,再来调用这个方法

func IsLetter

func IsLetter(str string) bool

IsLetter @Editor robotyang at 2023

IsLetter 判断是否为 纯字母

@Param str 待判断的字符

func IsSmallLetter

func IsSmallLetter(str string) bool

IsSmallLetter @Editor robotyang at 2023

IsSmallLetter 判断是否为 纯小写字母

@Param str 待判断的字符

func IsTWMobile

func IsTWMobile(tel string) bool

IsTWMobile

IsTWMobile 判断是否中国台湾号码

@Tips 建议先使用 TrimBlank 函数过滤特殊字符,再来调用这个方法

func IsZHLandline

func IsZHLandline(tel string) bool

IsZHLandline

IsZHLandline 判断是否中国大陆座机号(为0开头的3位或4位区号,可选加-,再加7位或8位电话号)

@Tips 建议先使用 TrimBlank 函数过滤特殊字符,再来调用这个方法

func IsZHMobile

func IsZHMobile(tel string) bool

IsZHMobile

IsZHMobile 判断是否中国大陆手机号(为+86或86开头或无,可选加-,再以1开头,再加10位数字)

@Tips 建议先使用 TrimBlank 函数过滤特殊字符,再来调用这个方法

@Reference https://mp.weixin.qq.com/s?__biz=MzA3MjMwMzg2Nw==&mid=2247497438&idx=2&sn=2a641c223490cc8073cc7b2e0b940182&chksm=9f22e34aa8556a5c2c81b798daa5a0e784faac088f4d93acc57b2e092704482ae929caf34607&scene=27

func SnakeString

func SnakeString(s string) string

@驼峰转蛇形 Editor robotyang at 2023

# 驼峰转蛇形 snake string
@description XxYy to xx_yy , XxYY to xx_y_y
@param s 需要转换的字符串
@Return string

func SnakeStringStrike

func SnakeStringStrike(s string) string

@驼峰转蛇形 Editor robotyang at 2023

# 驼峰转蛇形 snake string
@description XxYy to xx-yy , XxYY to xx-y-y
@param s 需要转换的字符串
@Return string

func TrimBlank

func TrimBlank(mob string) string

TrimBlank 去除全角空格和常规空白字符。

含半角空格、回车\r 换行\n 水平制表符\t 垂直制表符\v 换页符\f

@Reference 空格说明:https://www.wejias.com/html/article/article-24.html

func UpperFirst

func UpperFirst(s string) string

UpperFirst @Editor robotyang at 2023

UpperFirst 首字母大写

Types

type TelType

type TelType int
const (
	TelType_ZH   TelType = iota + 1 //大陆手机号
	TelType_ZHLD                    //大陆座机号
	TelType_HK                      //香港手机号
	TelType_AM                      //澳门手机号
	TelType_TW                      //台湾手机号
	TelType_QT                      //其他手机号
)

func ParseTelType

func ParseTelType(tel string) TelType

ParseTelType

ParseTelType 判断手机号类型(是否为港/澳/台/大陆手机or其他)

Jump to

Keyboard shortcuts

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