type str
impl strС версии. 1.0.0-beta
Методы
oxlMockCalls | (m: str) -> List<Call>S.calls(.m) is rewritten by the compiler to "pkg.module.S".oxlMockCalls("m") (D-6106, D-7250). |
len | () -> usizeLength in bytes. |
charCount | () -> usizeNumber of Unicode scalar values. |
isEmpty | () -> boolWhether there are no bytes. |
chars | () -> List<char>The chars (Unicode scalar values) in order. |
bytes | () -> List<u8>The UTF-8 bytes in order. |
contains | (needle: str) -> boolWhether needle occurs in the text. |
startsWith | (prefix: str) -> boolWhether the text begins with prefix. |
endsWith | (suffix: str) -> boolWhether the text ends with suffix. |
find | (needle: str) -> usize?Byte index of the first occurrence of needle. |
lower | () -> strThe text in lower case (Unicode simple case mapping). |
upper | () -> strThe text in upper case (Unicode simple case mapping). |
trim | () -> strThe text without leading and trailing whitespace. |
trimStart | () -> strThe text without leading whitespace. |
trimEnd | () -> strThe text without trailing whitespace. |
split | (sep: str) -> List<str>The pieces of the text between occurrences of sep (an empty piece for neighbouring separators); the text itself when sep does not occur. |
splitWhitespace | () -> List<str>The words of the text |
lines | () -> List<str>The lines of the text, without the line terminators (\n or \r\n). |
replace | (from: str, to: str) -> strThe text with every occurrence of from replaced by to. |
repeat | (n: usize) -> strThe text repeated n times. |
slice | (a: usize, b: usize) -> strSubstring of the byte range [a, b); panics unless both are char boundaries. |
parse | () -> T | ParseErrorParses the whole text as T (integer, float or bool); no surrounding whitespace is accepted. |
rfind | (needle: str) -> usize?Byte index of the last occurrence of needle. |
count | (needle: str) -> usizeNumber of non-overlapping occurrences of needle (0 for an empty needle). |
trimPrefix | (prefix: str) -> strself without the leading prefix (unchanged if it does not start with it). |
trimSuffix | (suffix: str) -> strself without the trailing suffix. |
splitOnce | (sep: str) -> (str, str)?Splits at the first sep |
replaceFirst | (from: str, to: str) -> strReplaces only the first occurrence. |
padStart | (width: usize, fill: char) -> strPads on the left with fill up to width characters. |
padEnd | (width: usize, fill: char) -> strPads on the right with fill up to width characters. |
isBlank | () -> boolTrue when the text is empty or only white space. |
eqIgnoreCase | (other: str) -> boolEqual after Unicode simple case mapping. |
asciiLower | () -> strLower-cases only A-Z (protocol tokens, header names). |
parseInt | () -> i64 | ParseErrorParses a decimal integer. |
parseFloat | () -> f64 | ParseErrorParses a decimal number. |
Определено в: std/core/testing.oxl:279
См. также
- std.core
- str.oxlMockCalls
- str.len
- str.charCount
- str.isEmpty
- str.chars
- str.bytes
- str.contains
- str.startsWith
- str.endsWith
- str.find
- str.lower
- str.upper
- str.trim
- str.trimStart
- str.trimEnd
- str.split
- str.splitWhitespace
- str.lines
- str.replace
- str.repeat
- str.slice
- str.parse
- str.rfind
- str.count
- str.trimPrefix
- str.trimSuffix
- str.splitOnce
- str.replaceFirst
- str.padStart
- str.padEnd
- str.isBlank
- str.eqIgnoreCase
- str.asciiLower
- str.parseInt
- str.parseFloat