core: Add str::is_alphanumeric fn and method
This commit is contained in:
parent
0746190826
commit
8fbd5ac049
1 changed files with 16 additions and 0 deletions
|
@ -1169,6 +1169,15 @@ fn is_whitespace(s: str) -> bool {
|
||||||
ret all(s, char::is_whitespace);
|
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 = "
|
#[doc = "
|
||||||
Returns the string length/size in bytes not counting the null terminator
|
Returns the string length/size in bytes not counting the null terminator
|
||||||
"]
|
"]
|
||||||
|
@ -1833,6 +1842,13 @@ impl extensions for str {
|
||||||
"]
|
"]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_whitespace() -> bool { is_whitespace(self) }
|
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]
|
#[inline]
|
||||||
#[doc ="Returns the size in bytes not counting the null terminator"]
|
#[doc ="Returns the size in bytes not counting the null terminator"]
|
||||||
fn len() -> uint { len(self) }
|
fn len() -> uint { len(self) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue