1
Fork 0

core: Add str::is_alphanumeric fn and method

This commit is contained in:
Brian Anderson 2012-06-02 23:42:20 -07:00
parent 0746190826
commit 8fbd5ac049

View file

@ -1169,6 +1169,15 @@ fn is_whitespace(s: str) -> bool {
ret all(s, char::is_whitespace);
}
#[doc = "
Returns true if the string contains only alphanumerics
Alphanumeric characters are determined by `char::is_alphanumeric`
"]
fn is_alphanumeric(s: str) -> bool {
ret all(s, char::is_alphanumeric);
}
#[doc = "
Returns the string length/size in bytes not counting the null terminator
"]
@ -1833,6 +1842,13 @@ impl extensions for str {
"]
#[inline]
fn is_whitespace() -> bool { is_whitespace(self) }
#[doc = "
Returns true if the string contains only alphanumerics
Alphanumeric characters are determined by `char::is_alphanumeric`
"]
#[inlune]
fn is_alphanumeric() -> bool { is_alphanumeric(self) }
#[inline]
#[doc ="Returns the size in bytes not counting the null terminator"]
fn len() -> uint { len(self) }