File tree Expand file tree Collapse file tree 8 files changed +156
-9
lines changed
Expand file tree Collapse file tree 8 files changed +156
-9
lines changed Original file line number Diff line number Diff line change 22
33このディレクトリには以下のサンプルがあります。
44
5- | file | example name | note |
6- | ------------------------------| -----------------------------------| -------------------------------------------------|
7- | hex \_ to \_ dec .go | strconvs \_ hex \_ to \_ dec | 16進数文字列を10進数に変換するサンプルです. |
8- | bin \_ to \_ dec .go | strconvs \_ bin \_ to \_ dec | 2進数文字列を10進数に変換するサンプルです. |
9- | dec \_ to \_ dec .go | strconvs \_ dec \_ to \_ dec | 10進数文字列を10進数に変換するサンプルです. |
10- | hex \_ to \_ bin .go | strconvs \_ hex \_ to \_ bin | 16進数文字列を2進数文字列に変換するサンプルです. |
11- | bin \_ to \_ hex .go | strconvs \_ bin \_ to \_ hex | 2進数文字列を16進数文字列に変換するサンプルです. |
12- | parseint \_ tips \_ bitsize .go | strconvs \_ parseint \_ tips \_ bitsize | strconv.ParseInt() の第3引数 bitSize を指定する際のTipsです。 |
13- | parseint \_ tips \_ basevalue .go | strconvs \_ parseint \_ tips \_ base | strconv.ParseInt() の第2引数 base を指定する際のTipsです。 |
5+ | file | example name | note |
6+ | -------------------------- | ------------------------------ | -------------------------------------------------------------- |
7+ | hex_to_dec .go | strconvs_hex_to_dec | 16進数文字列を10進数に変換するサンプルです. |
8+ | bin_to_dec .go | strconvs_bin_to_dec | 2進数文字列を10進数に変換するサンプルです. |
9+ | dec_to_dec .go | strconvs_dec_to_dec | 10進数文字列を10進数に変換するサンプルです. |
10+ | hex_to_bin .go | strconvs_hex_to_bin | 16進数文字列を2進数文字列に変換するサンプルです. |
11+ | bin_to_hex .go | strconvs_bin_to_hex | 2進数文字列を16進数文字列に変換するサンプルです. |
12+ | parseint_tips_bitsize .go | strconvs_parseint_tips_bitsize | strconv.ParseInt() の第3引数 bitSize を指定する際のTipsです。 |
13+ | parseint_tips_basevalue .go | strconvs_parseint_tips_base | strconv.ParseInt() の第2引数 base を指定する際のTipsです。 |
Original file line number Diff line number Diff line change @@ -38,4 +38,24 @@ func BinToDec() error {
3838 }
3939
4040 return nil
41+
42+ /*
43+ $ task
44+ task: [build] go build .
45+ task: [run] ./try-golang -onetime
46+
47+ ENTER EXAMPLE NAME: strconvs_bin_to_dec
48+
49+ [Name] "strconvs_bin_to_dec"
50+ [original] 11111111
51+ [parsed ] 255
52+ --------------------------------------------------
53+ [original] 11011110101011011011111011101111
54+ [parsed ] 3735928559
55+ --------------------------------------------------
56+
57+
58+ [Elapsed] 56.51µs
59+ */
60+
4161}
Original file line number Diff line number Diff line change @@ -43,4 +43,26 @@ func BinToHex() error {
4343 }
4444
4545 return nil
46+
47+ /*
48+ $ task
49+ task: [build] go build .
50+ task: [run] ./try-golang -onetime
51+
52+ ENTER EXAMPLE NAME: strconvs_bin_to_hex
53+
54+ [Name] "strconvs_bin_to_hex"
55+ [original] 0b11111111
56+ [parsed ] 255
57+ [conveted] ff
58+ --------------------------------------------------
59+ [original] 0b11011110101011011011111011101111
60+ [parsed ] 3735928559
61+ [conveted] deadbeef
62+ --------------------------------------------------
63+
64+
65+ [Elapsed] 1.44571ms
66+ */
67+
4668}
Original file line number Diff line number Diff line change @@ -36,5 +36,28 @@ func DecToDec() error {
3636 output .Stdoutl ("[atoi ]" , atoi (v ))
3737 output .StderrHr ()
3838 }
39+
3940 return nil
41+
42+ /*
43+ $ task
44+ task: [build] go build .
45+ task: [run] ./try-golang -onetime
46+
47+ ENTER EXAMPLE NAME: strconvs_dec_to_dec
48+
49+ [Name] "strconvs_dec_to_dec"
50+ [original] 255
51+ [parseInt] 255
52+ [atoi ] 255
53+ --------------------------------------------------
54+ [original] 3735928559
55+ [parseInt] 3735928559
56+ [atoi ] 3735928559
57+ --------------------------------------------------
58+
59+
60+ [Elapsed] 56.19µs
61+ */
62+
4063}
Original file line number Diff line number Diff line change @@ -43,4 +43,26 @@ func HexToBin() error {
4343 }
4444
4545 return nil
46+
47+ /*
48+ $ task
49+ task: [build] go build .
50+ task: [run] ./try-golang -onetime
51+
52+ ENTER EXAMPLE NAME: strconvs_hex_to_bin
53+
54+ [Name] "strconvs_hex_to_bin"
55+ [original] 0xff
56+ [parsed ] 255
57+ [conveted] 11111111
58+ --------------------------------------------------
59+ [original] 0xDEADBEEF
60+ [parsed ] 3735928559
61+ [conveted] 11011110101011011011111011101111
62+ --------------------------------------------------
63+
64+
65+ [Elapsed] 96.96µs
66+ */
67+
4668}
Original file line number Diff line number Diff line change @@ -33,5 +33,26 @@ func HexToDec() error {
3333 output .Stdoutl ("[parsed ]" , parsed )
3434 output .StdoutHr ()
3535 }
36+
3637 return nil
38+
39+ /*
40+ $ task
41+ task: Task "build" is up to date
42+ task: [run] ./try-golang -onetime
43+
44+ ENTER EXAMPLE NAME: strconvs_hex_to_dec
45+
46+ [Name] "strconvs_hex_to_dec"
47+ [original] ff
48+ [parsed ] 255
49+ --------------------------------------------------
50+ [original] deadbeef
51+ [parsed ] 3735928559
52+ --------------------------------------------------
53+
54+
55+ [Elapsed] 91.49µs
56+ */
57+
3758}
Original file line number Diff line number Diff line change @@ -49,4 +49,27 @@ func ParseIntTipsBaseValue() error {
4949 }
5050
5151 return nil
52+
53+ /*
54+ $ task
55+ task: [build] go build .
56+ task: [run] ./try-golang -onetime
57+
58+ ENTER EXAMPLE NAME: strconvs_parseint_tips_base
59+
60+ [Name] "strconvs_parseint_tips_base"
61+ [original] 0b11111111
62+ [parsed ] 255
63+ --------------------------------------------------
64+ [original] 0o377
65+ [parsed ] 255
66+ --------------------------------------------------
67+ [original] 0xff
68+ [parsed ] 255
69+ --------------------------------------------------
70+
71+
72+ [Elapsed] 52.669µs
73+ */
74+
5275}
Original file line number Diff line number Diff line change @@ -37,4 +37,20 @@ func ParseIntTipsBitSize() error {
3737 output .Stdoutl ("[parsed ]" , int (parsed ))
3838
3939 return nil
40+
41+ /*
42+ $ task
43+ task: [build] go build .
44+ task: [run] ./try-golang -onetime
45+
46+ ENTER EXAMPLE NAME: strconvs_parseint_tips_bitsize
47+
48+ [Name] "strconvs_parseint_tips_bitsize"
49+ [original] ff
50+ [parsed ] 255
51+
52+
53+ [Elapsed] 21.09µs
54+ */
55+
4056}
You can’t perform that action at this time.
0 commit comments