You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [feat] Allowing custom trim set characters
* Improving unit tests
* Update README.md
Co-authored-by: Matt Welke <[email protected]>
---------
Co-authored-by: Matt Welke <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,13 +89,14 @@ s := sanitizer.New(sanitizer.OptionDateFormat{
89
89
90
90
1.**max=`<n>`** - Maximum string length. It will truncate the string to `<n>` characters if this limit is exceeded
91
91
1.**trim** - Remove trailing spaces left and right
92
+
1.**trim=`<c>`** - Remove trailing characters `<c>` left and right. You can provide more than one character. Example: `trim= \n` will trim spaces and new lines
92
93
1.**lower** - Lowercase all characters in the string
93
94
1.**upper** - Uppercase all characters in the string
94
95
1.**title** - First character of every word is changed to uppercase, the rest to lowercase. Uses Go's built in `strings.Title()` function.
95
96
1.**cap** - Only the first letter of the string will be changed to uppercase, the rest to lowercase
96
97
1.**def=`<n>`** (only available for pointers) - Sets a default `<n>` value in case the pointer is `nil`
97
98
1.**xss** - Will remove brackets such as <>[](){} and the characters !=? from the string
98
-
1.**date** - Will parse the string using the input formats provided in the options and print it using the output format provided in the options. If the string can not be parsed, it will be left empty.
99
+
1.**date** - Will parse the string using the input formats provided in the options and print it using the output format provided in the options. If the string can not be parsed, it will be left empty
99
100
100
101
The order of precedence will be: **xss** -> **trim** -> **date** -> **max** -> **lower** -> **upper** -> **title** -> **cap**
0 commit comments