Changeset 250:55591bc3974c
- Timestamp:
- 07/06/08 11:26:06
(3 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- Parents:
249:b3dbd786541a 248:d10ff1f47f84
- branch:
- default
- Message:
merge
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r246 |
r250 |
|
| 11 | 11 | import tango.io.Stdout; |
|---|
| 12 | 12 | import tango.io.Print; |
|---|
| 13 | | import tango.stdc.stringz; |
|---|
| | 13 | static import tango.stdc.stringz; |
|---|
| 14 | 14 | static import tango.text.Util; |
|---|
| 15 | 15 | static import tango.text.Text; |
|---|
| … | … | |
| 150 | 150 | |
|---|
| 151 | 151 | public static String toHexString( int i ){ |
|---|
| | 152 | version(TANGOSVN) { |
|---|
| 152 | 153 | return tango.text.convert.Integer.toString(i, "x" ); |
|---|
| | 154 | } |
|---|
| | 155 | else{ |
|---|
| | 156 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); |
|---|
| | 157 | } |
|---|
| 153 | 158 | } |
|---|
| 154 | 159 | |
|---|
| 155 | 160 | public static String toOctalString( int i ){ |
|---|
| | 161 | version(TANGOSVN) { |
|---|
| 156 | 162 | return tango.text.convert.Integer.toString(i, "o" ); |
|---|
| | 163 | } |
|---|
| | 164 | else{ |
|---|
| | 165 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); |
|---|
| | 166 | } |
|---|
| 157 | 167 | } |
|---|
| 158 | 168 | |
|---|
| 159 | 169 | public static String toBinaryString( int i ){ |
|---|
| | 170 | version(TANGOSVN) { |
|---|
| 160 | 171 | return tango.text.convert.Integer.toString(i, "b" ); |
|---|
| | 172 | } |
|---|
| | 173 | else{ |
|---|
| | 174 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); |
|---|
| | 175 | } |
|---|
| 161 | 176 | } |
|---|
| 162 | 177 | |
|---|
| … | … | |
| 630 | 645 | } |
|---|
| 631 | 646 | |
|---|
| | 647 | public alias tango.stdc.stringz.toStringz toStringz; |
|---|
| | 648 | public alias tango.stdc.stringz.toString16z toString16z; |
|---|
| | 649 | public alias tango.stdc.stringz.fromStringz fromStringz; |
|---|
| | 650 | public alias tango.stdc.stringz.fromString16z fromString16z; |
|---|
| | 651 | |
|---|
| 632 | 652 | static String toHex(uint value, bool prefix = true, int radix = 8){ |
|---|
| | 653 | version(TANGOSVN) { |
|---|
| 633 | 654 | return tango.text.convert.Integer.toString( |
|---|
| 634 | 655 | value, |
|---|
| 635 | 656 | radix is 10 ? "d" : |
|---|
| 636 | | radix is 8 ? "o" : |
|---|
| 637 | | radix is 16 ? "x" : |
|---|
| 638 | | "d" |
|---|
| | 657 | radix is 8 ? "o" : |
|---|
| | 658 | radix is 16 ? "x" : |
|---|
| | 659 | "d" ); |
|---|
| | 660 | } |
|---|
| | 661 | else{ |
|---|
| | 662 | return tango.text.convert.Integer.toString( |
|---|
| | 663 | value, |
|---|
| | 664 | radix is 10 ? tango.text.convert.Integer.Style.Signed : |
|---|
| | 665 | radix is 8 ? tango.text.convert.Integer.Style.Octal : |
|---|
| | 666 | radix is 16 ? tango.text.convert.Integer.Style.Hex : |
|---|
| | 667 | tango.text.convert.Integer.Style.Signed, |
|---|
| | 668 | prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None |
|---|
| 639 | 669 | ); |
|---|
| | 670 | } |
|---|
| 640 | 671 | } |
|---|
| 641 | 672 | |
|---|