common

package
v0.0.0-...-9743816 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringUtil stringUtil = (*stringUtilImpl)(nil)

Functions

func BinarySearch

func BinarySearch[T any](a []T, key T, comparse func(a, b T) int) int

BinarySearch 使用二进制搜索算法在指定长度的数组中搜索指定的值,在进行此方法调用之前,须对数组进行排序(通过sort)方法, 如果未进行排序,则结果未定义。如果数组中包含多个具有指定值的元素,则无法保证会找到那一个元素所在的位置 如果未找到元素那么此结果必定小于0 comparse方法需手动编写, string中存在默认的方法 strings.Comparse 此方法返回一个由开发者指定比较的顺序整数 如 a == b return 0 a < b return -1 a > b return +1

func StringSort

func StringSort(vals ...string) []string

StringSort 字符串结构体排序

Types

This section is empty.

Jump to

Keyboard shortcuts

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