How to split string with Golang !

Splitting strings in golang

Split command in the strings package can help us !
str := "Test message !"
splittedStr := strings.Split(str, " ")
fmt.Println(len(splittedStr))
fmt.Println(splittedStr[0])

result :

3 Test

Also we can use strings.Fields command for parsing by space

fields := strings.Fields("Test Value!")
fmt.Println(len(fields))
fmt.Println(fields[0])

result :

2 Test

Base64 Encoder

Base64 encoder

Base64 Decoder

Send Feedback

Do you want to connect with me ?

Message length should be less than 1024 character!

Url Encoder

Encode to URL-encoded format

Byte to Mb Converter

How to print Hex result on Linux command line !

How to export hex result on linux Console ?

There is a simple way to export hex from the file

xxd command helps for us

xxd -p file
ubuntu@instance-20240128-1936:~/go-blog-dbs$ xxd /etc/localtime 
00000000: 545a 6966 3200 0000 0000 0000 0000 0000  TZif2...........
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0001 0000 0004 0000 0000  ................
00000030: 0000 5554 4300 545a 6966 3200 0000 0000  ..UTC.TZif2.....
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0001 0000  ................
00000060: 0004 0000 0000 0000 5554 4300 0a55 5443  ........UTC..UTC
00000070: 300a                                     0.