comparison dwt/dwthelper/utils.d @ 262:e10de397beb1

ADD version TANGOSVN
author Frank Benoit <benoit@tionex.de>
date Sun, 06 Jul 2008 15:33:12 +0200
parents 5a30aa9820f3
children d472fae79005
comparison
equal deleted inserted replaced
261:edcf78db8722 262:e10de397beb1
147 return null; 147 return null;
148 } 148 }
149 } 149 }
150 150
151 public static String toHexString( int i ){ 151 public static String toHexString( int i ){
152 version(TANGOSVN)
153 return tango.text.convert.Integer.toString(i, "x" );
154 }
155 else{
152 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); 156 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex );
157 }
153 } 158 }
154 159
155 public static String toOctalString( int i ){ 160 public static String toOctalString( int i ){
161 version(TANGOSVN)
162 return tango.text.convert.Integer.toString(i, "o" );
163 }
164 else{
156 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); 165 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal );
166 }
157 } 167 }
158 168
159 public static String toBinaryString( int i ){ 169 public static String toBinaryString( int i ){
170 version(TANGOSVN)
171 return tango.text.convert.Integer.toString(i, "b" );
172 }
173 else{
160 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); 174 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary );
175 }
161 } 176 }
162 177
163 public static String toString( int i ){ 178 public static String toString( int i ){
164 return tango.text.convert.Integer.toString(i); 179 return tango.text.convert.Integer.toString(i);
165 } 180 }
633 public alias tango.stdc.stringz.toString16z toString16z; 648 public alias tango.stdc.stringz.toString16z toString16z;
634 public alias tango.stdc.stringz.fromStringz fromStringz; 649 public alias tango.stdc.stringz.fromStringz fromStringz;
635 public alias tango.stdc.stringz.fromString16z fromString16z; 650 public alias tango.stdc.stringz.fromString16z fromString16z;
636 651
637 static String toHex(uint value, bool prefix = true, int radix = 8){ 652 static String toHex(uint value, bool prefix = true, int radix = 8){
653 version(TANGOSVN)
654 return tango.text.convert.Integer.toString(
655 value,
656 radix is 10 ? "d" :
657 radix is 8 ? "o" :
658 radix is 16 ? "x" :
659 "d" );
660 }
661 else{
638 return tango.text.convert.Integer.toString( 662 return tango.text.convert.Integer.toString(
639 value, 663 value,
640 radix is 10 ? tango.text.convert.Integer.Style.Signed : 664 radix is 10 ? tango.text.convert.Integer.Style.Signed :
641 radix is 8 ? tango.text.convert.Integer.Style.Octal : 665 radix is 8 ? tango.text.convert.Integer.Style.Octal :
642 radix is 16 ? tango.text.convert.Integer.Style.Hex : 666 radix is 16 ? tango.text.convert.Integer.Style.Hex :
643 tango.text.convert.Integer.Style.Signed, 667 tango.text.convert.Integer.Style.Signed,
644 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None 668 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None
645 ); 669 );
646 } 670 }
671 }
647 672
648 class RuntimeException : Exception { 673 class RuntimeException : Exception {
649 this( String e = null){ 674 this( String e = null){
650 super(e); 675 super(e);
651 } 676 }