Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added UUID generator method to CPString.

  • Loading branch information...
commit 1758e18bd248cb07814bd4aabfbc0caa30fbffec 1 parent 40def35
authored January 30, 2009 Ross Boucher committed February 04, 2009

Showing 1 changed file with 18 additions and 0 deletions. Show diff stats Hide diff stats

  1. 18  Foundation/CPString.j
18  Foundation/CPString.j
@@ -662,4 +662,22 @@ var CPStringHashes      = new objj_dictionary();
662 662
 
663 663
 @end
664 664
 
  665
+
  666
+@implementation CPString (UUID)
  667
+
  668
+/*!
  669
+    Returns a randomly generated Universally Unique Identifier.
  670
+*/
  671
++ (CPString)UUID
  672
+{
  673
+    var g = @"";
  674
+    
  675
+    for(var i = 0; i < 32; i++)
  676
+        g += Math.floor(Math.random() * 0xF).toString(0xF);
  677
+    
  678
+    return g;
  679
+}
  680
+
  681
+@end
  682
+
665 683
 String.prototype.isa = CPString;

0 notes on commit 1758e18

Please sign in to comment.
Something went wrong with that request. Please try again.