stringx

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsafeToBytes

func UnsafeToBytes(val string) []byte

UnsafeToBytes 非安全 string 转 []byte 他必须遵守上述规则

Example
package main

import (
	"fmt"

	"github.com/ecodeclub/ekit/stringx"
)

func main() {
	str := "hello"
	val := stringx.UnsafeToBytes(str)
	fmt.Println(len(val))
}
Output:

5

func UnsafeToString

func UnsafeToString(val []byte) string

UnsafeToString 非安全 []byte 转 string 他必须遵守上述规则

Example
package main

import (
	"fmt"

	"github.com/ecodeclub/ekit/stringx"
)

func main() {
	val := stringx.UnsafeToString([]byte("hello"))
	fmt.Println(val)
}
Output:

hello

Types

This section is empty.

Jump to

Keyboard shortcuts

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