mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
all: byte => u8
This commit is contained in:
parent
b49d873217
commit
d4a0d6f73c
221 changed files with 1365 additions and 1365 deletions
|
@ -36,35 +36,35 @@ pub fn (c u8) is_digit() bool {
|
|||
}
|
||||
|
||||
// is_hex_digit returns `true` if the byte is either in range 0-9, a-f or A-F and `false` otherwise.
|
||||
// Example: assert byte(`F`) == true
|
||||
// Example: assert u8(`F`) == true
|
||||
[inline]
|
||||
pub fn (c u8) is_hex_digit() bool {
|
||||
return (c >= `0` && c <= `9`) || (c >= `a` && c <= `f`) || (c >= `A` && c <= `F`)
|
||||
}
|
||||
|
||||
// is_oct_digit returns `true` if the byte is in range 0-7 and `false` otherwise.
|
||||
// Example: assert byte(`7`) == true
|
||||
// Example: assert u8(`7`) == true
|
||||
[inline]
|
||||
pub fn (c u8) is_oct_digit() bool {
|
||||
return c >= `0` && c <= `7`
|
||||
}
|
||||
|
||||
// is_bin_digit returns `true` if the byte is a binary digit (0 or 1) and `false` otherwise.
|
||||
// Example: assert byte(`0`) == true
|
||||
// Example: assert u8(`0`) == true
|
||||
[inline]
|
||||
pub fn (c u8) is_bin_digit() bool {
|
||||
return c == `0` || c == `1`
|
||||
}
|
||||
|
||||
// is_letter returns `true` if the byte is in range a-z or A-Z and `false` otherwise.
|
||||
// Example: assert byte(`V`) == true
|
||||
// Example: assert u8(`V`) == true
|
||||
[inline]
|
||||
pub fn (c u8) is_letter() bool {
|
||||
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`)
|
||||
}
|
||||
|
||||
// is_alnum returns `true` if the byte is in range a-z, A-Z, 0-9 and `false` otherwise.
|
||||
// Example: assert byte(`V`) == true
|
||||
// Example: assert u8(`V`) == true
|
||||
[inline]
|
||||
pub fn (c u8) is_alnum() bool {
|
||||
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || (c >= `0` && c <= `9`)
|
||||
|
@ -79,7 +79,7 @@ pub fn (c u8) is_capital() bool {
|
|||
}
|
||||
|
||||
// str_escaped returns the contents of `byte` as an escaped `string`.
|
||||
// Example: assert byte(0).str_escaped() == r'`\0`'
|
||||
// Example: assert u8(0).str_escaped() == r'`\0`'
|
||||
|
||||
pub fn (b u8) str_escaped() string {
|
||||
mut str := ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue