stringjuice

package
v1.36.19 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Description: This package provides utility functions for string manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertQueryStringToMap added in v1.19.4

func ConvertQueryStringToMap(input fmt.Stringer) (map[string][]string, error)

ConvertQueryStringToMap converts a query string to a map[string][]string.

It returns an error if the query string cannot be parsed.

func ConvertToType

func ConvertToType(input fmt.Stringer) (interface{}, error)

ConvertToType converts string value to the appropriate type.

It tries to convert to primitive.ObjectID, bool, int, float, time.Time, and if none of these succeed, it defaults to string.

func Normalize added in v1.36.19

func Normalize(input fmt.Stringer, opts NormalizeOpts) string

Normalize normalizes a string according to the provided options.

Types

type NormalizeOpts added in v1.36.19

type NormalizeOpts struct {
	ToLower        bool // Convert to lowercase.
	RemoveDiacs    bool // Remove diacritics.
	TrimSpace      bool // Remove leading and trailing whitespace.
	RemovePunct    bool // Remove punctuation.
	RemoveSpec     bool // Remove special characters.
	RemoveDigits   bool // Remove digits.
	RemoveNonASCII bool // Remove non-ASCII characters.
}

NormalizeOpts represents options for customizing the normalization process.

Jump to

Keyboard shortcuts

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