utils

package
v0.0.0-...-bbde6db Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(s string) string

Decrypt 字符串解密

func Encrypt

func Encrypt(s string) string

Encrypt 字符串加密

func GBK2Str

func GBK2Str(s string) string

GBK2Str GBK字符串转为UTF-8编码.

func GenDecrypt

func GenDecrypt(encrypted string, key []byte) ([]byte, error)

GenDecrypt 解密

func GenEncrypt

func GenEncrypt(value, key []byte) (string, error)

GenEncrypt 加密

func GinJSONData

func GinJSONData(code int, data interface{}, message string) gin.H

GinJSONData 返回统一的JSON响应数据

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding PKCS7

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

PKCS7UnPadding PKCS7

func SetCookie

func SetCookie(c *gin.Context, name, value string, maxAge int)

SetCookie 设置Cookie

func Str2GBK

func Str2GBK(s string) string

Str2GBK UTF-8字符串转为GBK编码.

func StrClean

func StrClean(s string) string

StrClean 剔除字符串的所有空白字符, 但会保留单个空格. 包含的字符有: "\r", "\n", "\t", 二个或三个空格.

func StrCut

func StrCut(s, begin, end string) string

StrCut 截取字符串.

func StrMap2GBK

func StrMap2GBK(m map[string]string) (result map[string]string)

StrMap2GBK 将map的所有字符串转为GBK编码. 由于正方教务系统还没有中文的key. 所以对value做转换就OK了.

func StrReplace

func StrReplace(s string, m map[string]string) string

StrReplace 将字符串按照map提供的映射进行替换.

Types

This section is empty.

Jump to

Keyboard shortcuts

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