changeset 124:1da8c82b1c84

Add: hasString for ResourceBundle to indicate if the string has length 0 or is not present
author Frank Benoit <benoit@tionex.de>
date Tue, 12 Feb 2008 02:21:26 +0100
parents f575eec94970
children 8b6d038b7f79
files dwt/dwthelper/ResourceBundle.d
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/ResourceBundle.d	Mon Feb 11 23:42:08 2008 +0100
+++ b/dwt/dwthelper/ResourceBundle.d	Tue Feb 12 02:21:26 2008 +0100
@@ -34,7 +34,7 @@
         while( dataIndex < data.length ){
             //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ );
             readLine();
-            line = tango.text.Util.trim( line );
+            line = line.trim();
             if( line.length is 0 ){
                 //tango.io.Stdout.Stdout.formatln( "properties put {} was 0 length", __LINE__ );
                 continue;
@@ -61,7 +61,7 @@
                     case 't': c = '\t'; break;
                     case 'n': c = '\n'; break;
                     case '\\': c = '\\'; break;
-                    default:  c = '?'; break;
+                    default: break;
                     }
                 }
                 else{
@@ -89,11 +89,11 @@
                 }
             }
             if( iskeypart ){
-                tango.io.Stdout.Stdout.formatln( "dwt.dwthelper.ResourceBundle ctor cannot find '='." );
+                //tango.io.Stdout.Stdout.formatln( "dwt.dwthelper.ResourceBundle ctor cannot find '='." );
                 continue;
             }
-            key = tango.text.Util.trim( key );
-            value = tango.text.Util.trim(value);
+            key = key.trim();
+            value = value.trim();
             //tango.io.Stdout.Stdout.formatln( "properties put {}=>{}", key, value );
 
             map[ key.dup ] = value.dup;
@@ -101,6 +101,10 @@
         }
     }
 
+    public bool hasString( char[] key ){
+        return ( key in map ) !is null;
+    }
+
     public char[] getString( char[] key ){
         if( auto v = key in map ){
             return (*v).dup;