Skip to content

Releases: nikitaksv/strmask

Release v1.0.1

06 Oct 21:56
Compare
Choose a tag to compare

Method Apply returned error with masked value

// Ex. phone number
maskedValue, _ := strmask.Apply("+0 (000) 000-00-00", "12345678900")
fmt.Println(maskedValue) // out: +1 (234) 567-89-00

// Ex. phone number with err
maskedValue, err := strmask.Apply("+0 (000) 000-00-00", "12345")
if err != nil {
	fmt.Println(err) // out: invalid value
}
fmt.Println(maskedValue) // but maskedValue out: +1 (234) 5

New Mask Symbols

Symbol Meaning
# Requires a unicode letter or digit at this position
l Requires a unicode letter (will be lower) at this position
U Requires a unicode letter (will be upper) or digit at this position
u Requires a unicode letter (will be upper) at this position

Release v1.0.0

02 Oct 19:24
5da24a3
Compare
Choose a tag to compare

Usage

maskedValue, _ := strmask.Apply("LLL-000-0", "ABC1234")
fmr.Println(maskedValue) // out: ABC-123-4

maskedValue, _ = strmask.Apply("LLL-000-0", "ABC-123-4")
fmr.Println(maskedValue) // out: ABC-123-4 

maskedValue, _ = strmask.Apply("LLL-000-0", "ABC1234XYZ")
fmr.Println(maskedValue) // out: ABC-123-4 

Mask Symbols

Symbol Meaning
0 Requires a decimal digit at this position
L Requires a unicode letter and digit at this position
l Requires a unicode letter at this position