Taiwan-built, self-hosted AI agent harness in a single Go binary — writes its own tools, sandbox-tests them, and shares them over MCP with Claude Code and Codex.
💪 700+ go util functions, support string, slice, datetime, net, crypt...
💅 Only depends on two kinds of libraries: go standard library and golang.org/x.
🌍 Unit test for every exported function.
Installation
Note:
For users who use go1.18 and above, it is recommended to install lancet v2.x.x. Cause in v2.x.x all functions were rewritten with generics of go1.18.
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
For users who use version below go1.18, you should install v1.x.x. The latest of v1.x.x is v1.4.6.
go get github.com/duke-git/lancet // below go1.18, install latest version of v1.x.x
Usage
Lancet organizes the code into package structure, and you need to import the corresponding package name when use it. For example, if you use string-related functions,import the strutil package like below:
import "github.com/duke-git/lancet/v2/strutil"
Example
Here takes the string function Reverse (reverse order string) as an example, and the strutil package needs to be imported.
package main
import (
"fmt"
"github.com/duke-git/lancet/v2/strutil"
)
func main() {
s := "hello"
rs := strutil.Reverse(s)
fmt.Println(rs) //olleh
}
AddMonth : add or sub months to time.
[doc]
[play]
AddYear : add or sub year to the time.
[doc]
[play]
AddDaySafe : add or sub days to the time and ensure that the returned date does not exceed the valid date of the target year and month.
[doc]
[play]
AddMonthSafe : add or sub months to the time and ensure that the returned date does not exceed the valid date of the target year and month.
[doc]
[play]
AddYearSafe : Add or sub years to the time and ensure that the returned date does not exceed the valid date of the target year and month.
[doc]
[play]
BeginOfMinute : return the date time at the begin of minute of specific date.
[doc]
[play]
BeginOfHour : return the date time at the begin of hour of specific date.
[doc]
[play]
BeginOfDay : return the date time at the begin of day of specific date.
[doc]
[play]
BeginOfWeek : return the date time at the begin of week of specific date.
[doc]
[play]
BeginOfMonth : return the date time at the begin of month of specific date.
[doc]
[play]
BeginOfYear : return the date time at the begin of year of specific date.
[doc]
[play]
EndOfMinute : return the date time at the end of minute of specific date.
[doc]
[play]
EndOfHour : return the date time at the end of hour of specific date.
[doc]
[play]
EndOfDay : return the date time at the end of day of specific date.
[doc]
[play]
EndOfWeek : return the date time at the end of week of specific date.
[doc]
[play]
EndOfMonth : return the date time at the end of month of specific date.
[doc]
[play]
EndOfYear : return the date time at the end of year of specific date.
[doc]
[play]
GetNowDate : return format yyyy-mm-dd of current date.
[doc]
[play]
GetNowTime : return format hh-mm-ss of current time.
[doc]
[play]
GetNowDateTime : return format yyyy-mm-dd hh-mm-ss of current datetime.
[doc]
[play]
GetTodayStartTime : return the start time of today, format: yyyy-mm-dd 00:00:00.
[doc]
[play]
GetTodayEndTime : return the end time of today, format: yyyy-mm-dd 23:59:59.
[doc]
[play]
GetZeroHourTimestamp : return timestamp of zero hour (timestamp of 00:00).
[doc]
[play]
GetNightTimestamp : return timestamp of zero hour (timestamp of 23:59).
[doc]
[play]
FormatTimeToStr : convert time to string.
[doc]
[play]
FormatStrToTime : convert string to time.
[doc]
[play]
NewUnix : return unix timestamp of specific time.
[doc]
[play]
NewUnixNow : return unix timestamp of current time.
[doc]
[play]
NewFormat : return unix timestamp of specific time string, t should be "yyyy-mm-dd hh:mm:ss".
[doc]
[play]
NewISO8601 : return unix timestamp of specific iso8601 time string.
[doc]
[play]
ChunkRead : reads a block from the file at the specified offset and returns all lines within the block.
[doc]
[play]
ParallelChunkRead : reads the file in parallel and send each chunk of lines to the specified channel.
[doc]
[play]
GetExeOrDllVersion : Get the version of exe or dll file on windows os.
[doc]
[play]
import "github.com/duke-git/lancet/v2/formatter"
Function list:
Comma : add comma to a number value by every 3 numbers from right, ahead by a prefix symbol char.
[doc]
[play]
Pretty : pretty print data to JSON string.
[doc]
[play]
PrettyToWriter : pretty encode data to writer.
[doc]
[play]
DecimalBytes : returns a human readable byte size under decimal standard (base 1000).
[doc]
[play]
BinaryBytes : returns a human-readable byte size under binary standard (base 1024).
[doc]
[play]
ParseDecimalBytes : return the human readable bytes size string into the amount it represents(base 1000).
[doc]
[play]
ParseBinaryBytes : return the human readable bytes size string into the amount it represents(base 1024).
[doc]
[play]
ParseCNAddress : parses a Chinese address string intelligently and extracts structured information (province, city, district, street, name, phone, etc.). Supports various address formats including county-level cities.
[doc]
[play]
ParsePersonInfo : extracts user information (name, phone, ID card, postal code) from an address string and separates it from the location address.
[doc]
[play]
import "github.com/duke-git/lancet/v2/function"
Function list:
After : return a function that invokes passed function once the returned function is called more than n times.
[doc]
[play]
Before : return a function that invokes passed function once the returned function is called less than n times
[doc]
[play]
Compose : compose the functions from right to left.
[doc]
[play]
Delay : call the function after delayed time.
[doc]
[play]
Debounceddeprecated : creates a debounced function that delays invoking fn until after wait duration have elapsed since the last time the debounced function was invoked.
[doc]
[play]
Debounce : creates a debounced version of the provided function.
[doc]
[play]
Throttle : creates a throttled version of the provided function.
[doc]
[play]
Schedule : invoke function every duration time, util close the returned bool channel.
[doc]
[play]
Pipeline : takes a list of functions and returns a function whose param will be passed into the functions one by one.
[doc]
[play]
AcceptIf : returns another function of the same signature as the apply function but also includes a bool value to indicate success or failure.
[doc]
[play]
And : returns a composed predicate that represents the logical AND of a list of predicates.
[doc]
[play]
Or : returns a composed predicate that represents the logical OR of a list of predicates.
[doc]
[play]
Negate : returns a predicate that represents the logical negation of this predicate.
[doc]
[play]
Nor : returns a composed predicate that represents the logical NOR of a list of predicates.
[doc]
[play]
Nand : returns a composed predicate that represents the logical Nand of a list of predicates.
[doc]
[play]
Xnor : returns a composed predicate that represents the logical XNOR of a list of predicates.
[doc]
[play]
Watcher : Watcher is used for record code execution time. can start/stop/reset the watch timer. get the elapsed time of function execution.
[doc]
[play]
import "github.com/duke-git/lancet/v2/maputil"
Function list:
MapTo : quick map any value to struct or any base type.
[doc]
[play]
ForEach : executes iteratee function for every key and value pair in map.
[doc]
[play]
Filter : iterates over map, return a new map contains all key and value pairs pass the predicate function.
[doc]
[play]
FilterByKeys : iterates over map, return a new map whose keys are all given keys
[doc]
[play]
FilterByValues : iterates over map, return a new map whose values are all given values.
[doc]
[play]
OmitBy : the opposite of Filter, removes all the map elements for which the predicate function returns true.
[doc]
[play]
OmitByKeys : the opposite of FilterByKeys, extracts all the map elements which keys are not omitted.
[doc]
[play]
OmitByValues : the opposite of FilterByValues. remove all elements whose value are in the give slice.
[doc]
[play]
Intersect : iterates over maps, return a new map of key and value pairs in all given maps.
[doc]
[play]
Keys : returns a slice of the map's keys.
[doc]
[play]
KeysBy : creates a slice whose element is the result of function mapper invoked by every map's key.
[doc]
[play]
Merge : merge maps, next key will overwrite previous key.
[doc]
[play]
Minus : creates a map of whose key in mapA but not in mapB.
[doc]
[play]
Values : returns a slice of the map's values.
[doc]
[play]
ValuesBy : creates a slice whose element is the result of function mapper invoked by every map's value.
[doc]
[play]
MapKeys : transforms a map to other type map by manipulating it's keys.
[doc]
[play]
MapValues : transforms a map to other type map by manipulating it's values.
[doc]
[play]
Entries : transforms a map into array of key/value pairs.
[doc]
[play]
FromEntries : creates a map based on a slice of key/value pairs.
[doc]
[play]
Transform : transform a map to another type map.
[doc]
[play]
IsDisjoint : check two map are disjoint if they have no keys in common.
[doc]
[play]
HasKey : checks if map has key or not.
[doc]
[play]
GetOrSet : returns value of the given key or set the given value value if not present.
[doc]
[play]
MapToStruct : converts map to struct.
[doc]
[play]
ToSortedSlicesDefault : converts a map to two slices sorted by key: one for the keys and another for the values.
[doc]
[play]
ToSortedSlicesWithComparator : converts a map to two slices sorted by key and using a custom comparison function: one for the keys and another for the values.
[doc]
[play]
NewOrderedMap : creates a new OrderedMap.
[doc]
[play]
OrderedMap_Set : sets the given key-value pair for ordered map.
[doc]
[play]
OrderedMap_Get : returns the value for the given key.
[doc]
[play]
OrderedMap_Delete : deletes the key-value pair for the given key.
[doc]
[play]
OrderedMap_Clear : clears the ordered map.
[doc]
[play]
OrderedMap_Front : returns the first key-value pair.
[doc]
[play]
OrderedMap_Back : returns the last key-value pair.
[doc]
[play]
OrderedMap_Range : calls the given function for each key-value pair.
[doc]
[play]
OrderedMap_Keys : returns the keys in order.
[doc]
[play]
OrderedMap_Values : returns the values in order.
[doc]
[play]
OrderedMap_Elements : returns the key-value pairs in order.
[doc]
[play]
OrderedMap_Len : returns the number of key-value pairs.
[doc]
[play]
OrderedMap_Contains : returns true if the given key exists.
[doc]
[play]
OrderedMap_Iter : returns a channel that yields key-value pairs in order.
[doc]
[play]
OrderedMap_ReverseIter : returns a channel that yields key-value pairs in reverse order.
[doc]
[play]
OrderedMap_SortByKey : sorts the map by key given less function.
[doc]
[play]
OrderedMap_MarshalJSON : implements the json.Marshaler interface.
[doc]
[play]
OrderedMap_UnmarshalJSON : implements the json.Unmarshaler interface.
[doc]
[play]
NewConcurrentMap : creates a ConcurrentMap with specific shard count.
[doc]
[play]
ConcurrentMap_Set : set the value for a key.
[doc]
[play]
ConcurrentMap_Get : get the value stored in the map for a key, or nil if no.
[doc]
[play]
ConcurrentMap_GetOrSet : returns the existing value for the key if present.
[doc]
[play]
ConcurrentMap_Delete : delete the value for a key.
[doc]
[play]
ConcurrentMap_GetAndDelete :returns the existing value for the key if present and then delete the value for the key.
[doc]
[play]
ConcurrentMap_Has : checks if map has the value for a key.
[doc]
[play]
ConcurrentMap_Range : calls iterator sequentially for each key and value present in each of the shards in the map.
[doc]
[play]
SortByKey : sorts the map by its keys and returns a new map with sorted keys.
[doc]
[play]
GetOrDefault : returns the value of the given key or a default value if the key is not present.
[doc]
[play]
FindValuesBy : returns a slice of values from the map that satisfy the given predicate function.
[doc]
[play]
ToMarkdownTable : Convert a map slice data to a Markdown table string. It supports custom header display names and column display order.
[doc]
[play]
import "github.com/duke-git/lancet/v2/mathutil"
Function list:
Average :return average value of numbers.
[doc]
[play]
BackoffStrategy : An interface that defines a method for calculating backoff intervals.
[doc]
RetryWithCustomBackoff : set abitary custom backoff strategy.
[doc]
[play]
RetryWithLinearBackoff : set linear strategy backoff.
[doc]
[play]
RetryWithExponentialWithJitterBackoff : set exponential strategy backoff.
[doc]
[play]
import "github.com/duke-git/lancet/v2/slice"
Function list:
AppendIfAbsent : if the item is absent,append it to the slice.
[doc]
[play]
Contain : check if the value is in the slice or not.
[doc]
[play]
ContainBy : returns true if predicate function return true.
[doc]
[play]
ContainSubSlice : check if the slice contain a given subslice or not.
[doc]
[play]
ContainAny : check if the slice contains any element from the targets slice.
[doc]
[play]
Chunk : creates a slice of elements split into groups the length of size.
[doc]
[play]
Compact : creates an slice with all falsy values removed. The values false, nil, 0, and "" are falsy.
[doc]
[play]
Concat : creates a new slice concatenating slice with any additional slices.
[doc]
[play]
Count : returns the number of occurrences of the given item in the slice.
[doc]
[play]
CountBy : iterates over elements of slice with predicate function, returns the number of all matched elements.
[doc]
[play]
Difference : creates an slice of whose element in slice but not in compared slice.
[doc]
[play]
DifferenceBy : accepts iteratee which is invoked for each element of slice and values to generate the criterion by which they're compared.
[doc]
[play]
DifferenceWith : accepts comparator which is invoked to compare elements of slice to values.
[doc]
[play]
DeleteAt : delete the element of slice at index.
[doc]
[play]
DeleteRange : delete the element of slice from start index to end index(exclude).
[doc]
[play]
Drop : drop n elements from the start of a slice.
[doc]
[play]
DropRight : drop n elements from the end of a slice.
[doc]
[play]
DropWhile : drop n elements from the start of a slice while predicate function returns true.
[doc]
[play]
DropRightWhile : drop n elements from the end of a slice while predicate function returns true.
[doc]
[play]
Equal : checks if two slices are equal: the same length and all elements' order and value are equal.
[doc]
[play]
EqualWith : checks if two slices are equal with comparator func.
[doc]
[play]
EqualUnordered : Checks if two slices are equal: the same length and all elements value are equal (unordered).
[doc]
[play]
Every : return true if all of the values in the slice pass the predicate function.
[doc]
[play]
Filter : iterates over elements of slice, returning an slice of all elements pass the predicate function.
[doc]
[play]
FilterMap : returns a slice which apply both filtering and mapping to the given slice.
[doc]
[play]
Finddeprecated : iterates over elements of slice, returning the first one that passes a truth test on predicate function.
[doc]
[play]
FindBy : iterates over elements of slice, returning the first one that passes a truth test on predicate function.
[doc]
[play]
FindLastdeprecated : return the last item that passes a truth test on predicate function.
[doc]
[play]
FindLastBy : iterates over elements of slice, returning the last one that passes a truth test on predicate function.
[doc]
[play]
FlattenDeep : flattens slice recursive to one level.
[doc]
[play]
FlatMap : manipulates a slice and transforms and flattens it to a slice of another type.
[doc]
[play]
ForEach : iterates over elements of slice and invokes function for each element.
[doc]
[play]
ForEachWithBreak : iterates over elements of slice and invokes function for each element, when iteratee return false, will break the for each loop.
[doc]
[play]
ForEachConcurrent : applies the iteratee function to each item in the slice concurrently.
[doc]
[play]
GroupBy : iterate over elements of the slice, each element will be group by criteria, returns two slices.
[doc]
[play]
GroupWith : return a map composed of keys generated from the results of running each element of slice thru iteratee.
[doc]
[play]
IntSlicedeprecated : convert param to int slice.
[doc]
[play]
InterfaceSlicedeprecated : convert param to interface slice.
[doc]
[play]
Intersection : creates a slice of unique elements that included by all slices.
[doc]
[play]
InsertAt : insert the value or other slice into slice at index.
[doc]
[play]
IndexOf : returns the index at which the first occurrence of an item is found in a slice.
[doc]
[play]
LastIndexOf : returns the index at which the last occurrence of the item is found in a slice.
[doc]
[play]
Map : creates an slice of values by running each element of slice thru iteratee function.
[doc]
[play]
MapConcurrent : applies the iteratee function to each item in the slice by concrrent.
[doc]
[play]
Merge : merge all given slices into one slice.
[doc]
[play]
Reverse : return slice of element order is reversed to the given slice.
[doc]
[play]
Reducedeprecated : creates an slice of values by running each element of slice thru iteratee function.(Deprecated: use ReduceBy)
[doc]
[play]
ReduceBy : produces a value from slice by accumulating the result of each element as passed through the reducer function.
[doc]
[play]
ReduceRight : ReduceRight is like ReduceBy, but it iterates over elements of slice from right to left.
[doc]
[play]
ReduceConcurrent : reduces the slice to a single value by applying the reducer function to each item in the slice concurrently.
[doc]
[play]
Replace : returns a copy of the slice with the first n non-overlapping instances of old replaced by new.
[doc]
[play]
ReplaceAll : returns a copy of the slice with all non-overlapping instances of old replaced by new.
[doc]
[play]
Repeat : creates a slice with length n whose elements are passed item.
[doc]
[play]
ShuffleCopy : return a new slice with elements shuffled.
[doc]
[play]
IsAscending : Checks if a slice is ascending order.
[doc]
[play]
IsDescending : Checks if a slice is descending order.
[doc]
[play]
IsSorted : Checks if a slice is sorted (ascending or descending).
[doc]
[play]
IsSortedByKey : Checks if a slice is sorted by iteratee function.
[doc]
[play]
Sort : sorts a slice of any ordered type(number or string).
[doc]
[play]
SortBy : sorts the slice in ascending order as determined by the less function.
[doc]
[play]
SortByFielddeprecated : return sorted slice by specific field.
[doc]
[play]
Some : return true if any of the values in the list pass the predicate function.
[doc]
[play]
StringSlicedeprecated : convert param to slice of string.
[doc]
[play]
SymmetricDifference : the symmetric difference of two slice, also known as the disjunctive union.
[doc]
[play]
ToSlice : returns a slices of a variable parameter transformation.
[doc]
[play]
ToSlicePointer : returns a pointer to the slices of a variable parameter transformation.
[doc]
[play]
Unique : remove duplicate elements in slice.
[doc]
[play]
UniqueBy : remove duplicate elements from the input slice based on the values returned by the iteratee function.
[doc]
[play]
UniqueByComparator : remove duplicate elements from the input slice using the provided comparator function.
[doc]
[play]
UniqueByField : remove duplicate elements in struct slice by struct field.
[doc]
[play]
UniqueByConcurrent : remove duplicate elements from the slice by concurrent.
[doc]
[play]
Union : creates a slice of unique elements, in order, from all given slices.
[doc]
[play]
UnionBy : accepts iteratee which is invoked for each element of each slice, then union slice.
[doc]
[play]
UpdateAt : update the slice element at index.
[doc]
[play]
Without : creates a slice excluding all given items.
[doc]
[play]
KeyBy : converts a slice to a map based on a callback function.
[doc]
[play]
Join : join the slice item with specify separator.
[doc]
[play]
Partition : partition all slice elements with the evaluation of the given predicate functions.
[doc]
[play]
Random : get a random item of slice, return its index, when slice is empty, return -1.
[doc]
[play]
SetToDefaultIf : set elements to their default value if they match the given predicate.
[doc]
[play]
Break : breaks a list into two parts at the point where the predicate for the first time is true.
[doc]
RightPadding : adds padding to the right end of a slice.
[doc]
[play]
LeftPadding : adds padding to the left begin of a slice.
[doc]
[play]
Frequency : counts the frequency of each element in the slice.
[doc]
[play]
JoinFunc : joins the slice elements into a single string with the given separator.
[doc]
[play]
ConcatBy : concats the elements of a slice into a single value using the provided separator and connector function.
[doc]
[play]
import "github.com/duke-git/lancet/v2/stream"
Function list:
Of : creates a stream whose elements are the specified values.
[doc]
[play]
FromSlice : creates a stream from slice.
[doc]
[play]
FromChannel : creates a stream from channel.
[doc]
[play]
FromRange : creates a number stream from start to end. both start and end are included. [start, end]
[doc]
[play]
Generate : creates a stream where each element is generated by the provided generator function.
[doc]
[play]
Concat : creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.
[doc]
[play]
Distinct : creates returns a stream that removes the duplicated items.
[doc]
[play]
Filter : returns a stream consisting of the elements of this stream that match the given predicate.
[doc]
[play]
FilterConcurrent : Applies the provided filter function predicate to each element of the input slice concurrently.
[doc]
[play]
Map : returns a stream consisting of the elements of this stream that apply the given function to elements of stream.
[doc]
[play]
Peek : returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.
[doc]
[play]
Skip : returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream.
[doc]
[play]
Limit : returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length.
[doc]
[play]
Reverse : returns a stream whose elements are reverse order of given stream.
[doc]
[play]
ReverseCopy : returns a new slice of element order is reversed to the given slice.
[doc]
[play]
Range : returns a stream whose elements are in the range from start(included) to end(excluded) original stream.
[doc]
[play]
Sorted : returns a stream consisting of the elements of this stream, sorted according to the provided less function.
[doc]
[play]
ForEach : performs an action for each element of this stream.
[doc]
[play]
Reduce : performs a reduction on the elements of this stream, using an associative accumulation function, and returns an Optional describing the reduced value, if any.
[doc]
[play]
FindFirst : returns the first element of this stream and true, or zero value and false if the stream is empty.
[doc]
[play]
FindLast : returns the last element of this stream and true, or zero value and false if the stream is empty.
[doc]
[play]
Max : returns the maximum element of this stream according to the provided less function. less function: a > b
[doc]
[play]
Min : returns the minimum element of this stream according to the provided less function. less function: a < b
[doc]
[play]
AllMatch : returns whether all elements of this stream match the provided predicate.
[doc]
[play]
AnyMatch : returns whether any elements of this stream match the provided predicate.
[doc]
[play]
NoneMatch : returns whether no elements of this stream match the provided predicate.
[doc]
[play]
Count : returns the count of elements in the stream.
[doc]
[play]
ToSlice : returns the elements in the stream.
[doc]
[play]
IndexOf : returns the index of the first occurrence of the specified element in this stream.
[doc]
[play]
LastIndexOf : returns the index of the last occurrence of the specified element in this stream.
[doc]
[play]
After : returns the substring after the first occurrence of a specific string in the source string.
[doc]
[play]
AfterLast : returns the substring after the last occurrence of a specific string in the source string. [doc]
[play]
Before : returns the substring before the first occurrence of a specific string in the source string.
[doc]
[play]
BeforeLast : returns the substring before the last occurrence of a specific string in the source string.
[doc]
[play]
CamelCase : coverts source string to its camelCase string.
[doc]
[play]
UpperCamelCase : coverts source string to its UpperCamelCase string.
[doc]
[play]
Capitalize : converts the first character of source string to upper case and the remaining to lower case.
[doc]
[play]
ContainsAll : return true if target string contains all the substrings.
[doc]
[play]
ContainsAny : return true if target string contains any one of the substrings.
[doc]
[play]
IsString : checks if the parameter value data type is string or not.
[doc]
[play]
KebabCase : coverts string to kebab-case string.
[doc]
[play]
UpperKebabCase : coverts string to upper KEBAB-CASE string.
[doc]
[play]
LowerFirst : converts the first character of string to lower case.
[doc]
[play]
UpperFirst : converts the first character of string to upper case.
[doc]
[play]
Pad : pads string on the left and right side if it's shorter than size.
[doc]
[play]
PadEnd : pads string with given characters on the right side if it's shorter than limit size. Padding characters are truncated if they exceed size.
[doc]
[play]
PadStart : pads string with given characters on the left side if it's shorter than limit size. Padding characters are truncated if they exceed size.
[doc]
[play]
Reverse : returns string whose char order is reversed to the given string.
[doc]
[play]
SnakeCase : coverts string to snake_case string.
[doc]
[play]
UpperSnakeCase : coverts string to upper SNAKE_CASE string.
[doc]
[play]
SplitEx : split a given string which can control the result slice contains empty string or not.
[doc]
[play]
Substring : returns a substring of the specific length starting at the specific offset position.
[doc]
[play]
Wrap : wrap a string with given string.
[doc]
[play]
Unwrap : unwrap a given string from anther string. will change source string.
[doc]
[play]
SplitWords : splits a string into words, word only contains alphabetic characters.
[doc]
[play]
WordCount : return the number of meaningful word of a string, word only contains alphabetic characters.
[doc]
[play]
RemoveNonPrintable : remove non-printable characters from a string.
[doc]
[play]
StringToBytes : converts a string to byte slice without a memory allocation.
[doc]
[play]
BytesToString : converts a byte slice to string without a memory allocation.
[doc]
[play]
IsBlank : checks if a string is whitespace or empty.
[doc]
[play]
IsNotBlank : checks if a string is not whitespace or not empty.
[doc]
[play]
HasPrefixAny : checks if a string starts with any of an array of specified strings.
[doc]
[play]
HasSuffixAny : checks if a string ends with any of an array of specified strings.
[doc]
[play]
IndexOffset : returns the index of the first instance of substr in string after offsetting the string by idxFrom.
[doc]
[play]
ReplaceWithMap : returns a copy of str, which is replaced by a map in unordered way, case-sensitively.
[doc]
[play]
Trim : strips whitespace (or other characters) from the beginning and end of a string.
[doc]
[play]
SplitAndTrim : splits string str by a string delimiter to a slice, and calls Trim to every element of slice.
[doc]
[play]
HideString : Hide some chars in source string with param replaceChar.
[doc]
[play]
RemoveWhiteSpace : remove whitespace characters from a string.
[doc]
[play]
SubInBetween : return substring between the start and end position(excluded) of source string.
[doc]
[play]
HammingDistance : calculates the Hamming distance between two strings.
[doc]
[play]