strutil

package
v0.0.0-...-68e2806 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(s string) bool

func IsNotEmpty

func IsNotEmpty(s string) bool

func MaskBankCard

func MaskBankCard(cardNumber string) string

MaskBankCard masks the middle part of a bank card number, keeping the first 4 and last 4 digits visible, with exactly 6 asterisks in between. Example: "6225123412341234" becomes "6225******1234"

func MaskEmail

func MaskEmail(email string) string

MaskEmail masks the local part of an email address, keeping the first and last character visible, with exactly 6 asterisks in between. Example: "user@example.com" becomes "u******r@example.com"

func MaskPhone

func MaskPhone(phone string) string

MaskPhone masks the middle part of a phone number, keeping the first 3 and last 4 digits visible, with exactly 6 asterisks in between. Example: "13812345678" becomes "138******5678"

func MaskString

func MaskString(s string, start, end int) string

MaskString masks the middle part of a string with exactly 6 asterisks (*), keeping the specified number of characters visible at the start and end. If the string is too short to mask, it will be padded with 6 asterisks. Parameters:

  • s: the original string to mask
  • start: number of characters to keep visible at the start
  • end: number of characters to keep visible at the end

Example:

MaskString("1234567890", 3, 2) returns "123******90"
MaskString("abc@example.com", 3, 4) returns "abc******e.com"

func RandomString

func RandomString(length int) string

func RandomStringWithCharset

func RandomStringWithCharset(length int, charset string) string

func Title

func Title(s ...string) string

Types

This section is empty.

Directories

Path Synopsis
Package cnst provides constants for HTTP headers and security related constants .
Package cnst provides constants for HTTP headers and security related constants .

Jump to

Keyboard shortcuts

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