forked from go/golangs_learn
viviman
3 years ago
4 changed files with 60 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
|||
<assemblyIdentity |
|||
version="1.0.0.0" |
|||
processorArchitecture="x86" |
|||
name="controls" |
|||
type="win32" |
|||
></assemblyIdentity> |
|||
<dependency> |
|||
<dependentAssembly> |
|||
<assemblyIdentity |
|||
type="win32" |
|||
name="Microsoft.Windows.Common-Controls" |
|||
version="6.0.0.0" |
|||
processorArchitecture="*" |
|||
publicKeyToken="6595b64144ccf1df" |
|||
language="*" |
|||
></assemblyIdentity> |
|||
</dependentAssembly> |
|||
</dependency> |
|||
</assembly> |
@ -0,0 +1,39 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"encoding/hex" |
|||
"fmt" |
|||
) |
|||
|
|||
func main() { |
|||
fmt.Println("\n ================== 基础类型 = 开始 ================== ") |
|||
|
|||
boolvar := true |
|||
fmt.Println("布尔\t boolvar = ", boolvar) |
|||
|
|||
var intvar int |
|||
fmt.Println("整形\t intvar = ", intvar) |
|||
|
|||
var float32var float32 |
|||
fmt.Println("浮点型\t float32var = ", float32var) |
|||
|
|||
var bytevar byte |
|||
bytevar = 'a' |
|||
fmt.Println("字符\t bytevar = ", bytevar) |
|||
|
|||
var int32 byte |
|||
int32 = 0x31 |
|||
//int32 = int32+1
|
|||
fmt.Println("16进制数值\t int32 = ", int32) |
|||
|
|||
// 注意"Hello"与"encodedStr"不相等,encodedStr是用字符串来表示16进制
|
|||
src := []byte("Hello") |
|||
// [72 101 108 108 111]
|
|||
fmt.Println("16进制Hex\t src = ", src) |
|||
// 48656c6c6f -> 48(4*16+8=72) 65(6*16+5=101) 6c 6c 6f
|
|||
encodedStr := hex.EncodeToString(src) |
|||
fmt.Println("16进制Hex\t encodedStr = ", encodedStr) |
|||
|
|||
intcodedStr := hex.EncodeToString([]byte("192.168.1.123")) |
|||
fmt.Println("16进制Hex\t intcodedStr = ", intcodedStr) |
|||
} |
Binary file not shown.
After Width: | Height: | Size: 264 KiB |
Loading…
Reference in new issue