Skip to content

Commit

Permalink
Merge pull request #760 from devlights/add-result-in-example
Browse files Browse the repository at this point in the history
  • Loading branch information
devlights authored Feb 27, 2024
2 parents aa8426d + ec1a009 commit a28d1b5
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/basic/strconvs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

このディレクトリには以下のサンプルがあります。

| file | example name | note |
|------------------------------|-----------------------------------|-------------------------------------------------|
| hex\_to\_dec.go | strconvs\_hex\_to\_dec | 16進数文字列を10進数に変換するサンプルです. |
| bin\_to\_dec.go | strconvs\_bin\_to\_dec | 2進数文字列を10進数に変換するサンプルです. |
| dec\_to\_dec.go | strconvs\_dec\_to\_dec | 10進数文字列を10進数に変換するサンプルです. |
| hex\_to\_bin.go | strconvs\_hex\_to\_bin | 16進数文字列を2進数文字列に変換するサンプルです. |
| bin\_to\_hex.go | strconvs\_bin\_to\_hex | 2進数文字列を16進数文字列に変換するサンプルです. |
| parseint\_tips\_bitsize.go | strconvs\_parseint\_tips\_bitsize | strconv.ParseInt() の第3引数 bitSize を指定する際のTipsです。 |
| parseint\_tips\_basevalue.go | strconvs\_parseint\_tips\_base | strconv.ParseInt() の第2引数 base を指定する際のTipsです。 |
| file | example name | note |
| -------------------------- | ------------------------------ | -------------------------------------------------------------- |
| hex_to_dec.go | strconvs_hex_to_dec | 16進数文字列を10進数に変換するサンプルです. |
| bin_to_dec.go | strconvs_bin_to_dec | 2進数文字列を10進数に変換するサンプルです. |
| dec_to_dec.go | strconvs_dec_to_dec | 10進数文字列を10進数に変換するサンプルです. |
| hex_to_bin.go | strconvs_hex_to_bin | 16進数文字列を2進数文字列に変換するサンプルです. |
| bin_to_hex.go | strconvs_bin_to_hex | 2進数文字列を16進数文字列に変換するサンプルです. |
| parseint_tips_bitsize.go | strconvs_parseint_tips_bitsize | strconv.ParseInt() の第3引数 bitSize を指定する際のTipsです。 |
| parseint_tips_basevalue.go | strconvs_parseint_tips_base | strconv.ParseInt() の第2引数 base を指定する際のTipsです。 |
20 changes: 20 additions & 0 deletions examples/basic/strconvs/bin_to_dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@ func BinToDec() error {
}

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_bin_to_dec
[Name] "strconvs_bin_to_dec"
[original] 11111111
[parsed ] 255
--------------------------------------------------
[original] 11011110101011011011111011101111
[parsed ] 3735928559
--------------------------------------------------
[Elapsed] 56.51µs
*/

}
22 changes: 22 additions & 0 deletions examples/basic/strconvs/bin_to_hex.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,26 @@ func BinToHex() error {
}

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_bin_to_hex
[Name] "strconvs_bin_to_hex"
[original] 0b11111111
[parsed ] 255
[conveted] ff
--------------------------------------------------
[original] 0b11011110101011011011111011101111
[parsed ] 3735928559
[conveted] deadbeef
--------------------------------------------------
[Elapsed] 1.44571ms
*/

}
23 changes: 23 additions & 0 deletions examples/basic/strconvs/dec_to_dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,28 @@ func DecToDec() error {
output.Stdoutl("[atoi ]", atoi(v))
output.StderrHr()
}

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_dec_to_dec
[Name] "strconvs_dec_to_dec"
[original] 255
[parseInt] 255
[atoi ] 255
--------------------------------------------------
[original] 3735928559
[parseInt] 3735928559
[atoi ] 3735928559
--------------------------------------------------
[Elapsed] 56.19µs
*/

}
22 changes: 22 additions & 0 deletions examples/basic/strconvs/hex_to_bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,26 @@ func HexToBin() error {
}

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_hex_to_bin
[Name] "strconvs_hex_to_bin"
[original] 0xff
[parsed ] 255
[conveted] 11111111
--------------------------------------------------
[original] 0xDEADBEEF
[parsed ] 3735928559
[conveted] 11011110101011011011111011101111
--------------------------------------------------
[Elapsed] 96.96µs
*/

}
21 changes: 21 additions & 0 deletions examples/basic/strconvs/hex_to_dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,26 @@ func HexToDec() error {
output.Stdoutl("[parsed ]", parsed)
output.StdoutHr()
}

return nil

/*
$ task
task: Task "build" is up to date
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_hex_to_dec
[Name] "strconvs_hex_to_dec"
[original] ff
[parsed ] 255
--------------------------------------------------
[original] deadbeef
[parsed ] 3735928559
--------------------------------------------------
[Elapsed] 91.49µs
*/

}
23 changes: 23 additions & 0 deletions examples/basic/strconvs/parseint_tips_basevalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,27 @@ func ParseIntTipsBaseValue() error {
}

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_parseint_tips_base
[Name] "strconvs_parseint_tips_base"
[original] 0b11111111
[parsed ] 255
--------------------------------------------------
[original] 0o377
[parsed ] 255
--------------------------------------------------
[original] 0xff
[parsed ] 255
--------------------------------------------------
[Elapsed] 52.669µs
*/

}
16 changes: 16 additions & 0 deletions examples/basic/strconvs/parseint_tips_bitsize.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@ func ParseIntTipsBitSize() error {
output.Stdoutl("[parsed ]", int(parsed))

return nil

/*
$ task
task: [build] go build .
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: strconvs_parseint_tips_bitsize
[Name] "strconvs_parseint_tips_bitsize"
[original] ff
[parsed ] 255
[Elapsed] 21.09µs
*/

}

0 comments on commit a28d1b5

Please sign in to comment.