changeset 184:ca249978ae96

Add join method to array
author Mike Pavone <pavone@retrodev.com>
date Sun, 25 Aug 2013 14:44:43 -0700
parents 97f107b9e8d3
children 181d8754a2ae
files modules/array.tp
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/array.tp	Sat Aug 24 19:03:18 2013 -0700
+++ b/modules/array.tp	Sun Aug 25 14:44:43 2013 -0700
@@ -102,4 +102,18 @@
 		}
 		ret
 	}
+
+	join <- :sep {
+		if: length > 0 {
+			str <- get: 0
+			idx <- 1
+			l <- length
+			while: { idx < l } do: {
+				str <- str . sep . (get: idx)
+			}
+			str
+		} else: {
+			""
+		}
+	}
 }