# HG changeset patch # User Frank Benoit # Date 1219332824 -7200 # Node ID 708cbfe418e7679dde77cdd745a0c5b9edc5253b # Parent 9b075603b4fca71b2011cfe07b17857a089167ce sync with dwt-linux diff -r 9b075603b4fc -r 708cbfe418e7 dwt/dwthelper/utils.d --- a/dwt/dwthelper/utils.d Thu Aug 21 16:22:18 2008 +0200 +++ b/dwt/dwthelper/utils.d Thu Aug 21 17:33:44 2008 +0200 @@ -197,7 +197,7 @@ public static int parseInt( String s, int radix ){ try{ - return tango.text.convert.Integer.parse( s, cast(uint)radix ); + return tango.text.convert.Integer.toLong( s, radix ); } catch( IllegalArgumentException e ){ throw new NumberFormatException( e ); @@ -206,7 +206,7 @@ public static int parseInt( String s ){ try{ - return tango.text.convert.Integer.parse( s ); + return tango.text.convert.Integer.toLong( s ); } catch( IllegalArgumentException e ){ throw new NumberFormatException( e ); @@ -372,6 +372,10 @@ } return res; } + +/++ + + + +/ int indexToCodepointIndex( String str, int index ){ if( index < 0 ) return index; int i = 0; @@ -397,6 +401,9 @@ return res; } +/++ + + Get that String, that contains the next codepoint of a String. + +/ String firstCodePointStr( String str, out int consumed ){ dchar[1] buf; uint ate; @@ -405,6 +412,12 @@ return str[ 0 .. ate ]; } +/++ + + Get first codepoint of a String. If an offset is needed, simply use a slice: + + --- + + dchar res = str[ offset .. $ ].firstCodePoint(); + + --- + +/ dchar firstCodePoint( String str ){ int dummy; return firstCodePoint( str, dummy );