about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-01 18:15:18 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-01 18:55:51 -0700
commit598e25e09194f3ff89d413d9bb2a4246ce5cfeee (patch)
tree9844d6932a9f647ce4a1955a8ede6d03dcbf5ef5 /src/lib
parent0c7a95fde5c1ea6d686c5194f2d46ff0f7305aca (diff)
downloadrust-598e25e09194f3ff89d413d9bb2a4246ce5cfeee.tar.gz
rust-598e25e09194f3ff89d413d9bb2a4246ce5cfeee.zip
Add std::char_slice
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/str.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/str.rs b/src/lib/str.rs
index 0adf3561165..b3a94cd6e12 100644
--- a/src/lib/str.rs
+++ b/src/lib/str.rs
@@ -53,6 +53,7 @@ export unsafe_from_bytes_ivec;
 export is_empty;
 export is_not_empty;
 export replace;
+export char_slice;
 
 native "rust" mod rustrt {
     type sbuf;
@@ -518,6 +519,11 @@ fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str {
     }
 }
 
+// FIXME: Also not efficient
+fn char_slice(s: &str, begin: uint, end: uint) -> str {
+    from_chars(vec::slice(to_chars(s), begin, end))
+}
+
 // Local Variables:
 // mode: rust;
 // fill-column: 78;