Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=b0c9b37376c3472a26bcb307e156f08c65a26838

commit b0c9b37376c3472a26bcb307e156f08c65a26838
Author: James Buren <r...@frugalware.org>
Date:   Thu Jun 4 11:23:07 2009 -0500

util.m
* initial draft

diff --git a/util.m b/util.m
new file mode 100644
index 0000000..a5620b8
--- /dev/null
+++ b/util.m
@@ -0,0 +1,46 @@
+#include <ctype.h>
+#include "util.h"
+
+...@implementation UString
++ fscanf: (IOD) f count: (int) n
+{
+       id str = [super new:n];
+       char buf[24];
+
+       sprintf(buf,"%%%ds",n);
+
+       fscanf(f,buf,[str str]);
+
+       return str;
+}
+- lstrip: (BOOL) ls rstrip: (BOOL) rs
+{
+       unsigned lw = 0, tw = 0;
+
+       if(ls)
+               while( isspace([self charAt:lw]) )
+                       ++lw;
+
+       if(rs)
+               while( isspace([self charAt:[self size]-1-tw]) )
+                       ++tw;
+
+       if(lw+tw == 0)
+               return self;
+
+       if( lw == [self size] || tw == [self size] )
+       {
+               [self assignSTR:""];
+               return self;
+       }
+
+       if(lw)
+               [self deleteFrom:0 to:lw-1];
+
+       if(tw)
+               [self deleteFrom:[self size]-tw to:[self size]-1];
+
+       return self;
+}
+...@end
+/* -%- indent-width: 4; tab-width: 4; lang: objc -%- */
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to