aboutsummaryrefslogtreecommitdiff
path: root/lib/std/ascii.zig
AgeCommit message (Collapse)Author
2025-10-31std: Skip element comparisons if `mem.order` args point to same memoryJay Petacat
This optimization is used in `mem.eql`, but was missing from `order`, `orderZ`, and `ascii.orderIgnoreCase`.
2025-08-31std.fmt: delete deprecated APIsAndrew Kelley
std.fmt.Formatter -> std.fmt.Alt std.fmt.format -> std.Io.Writer.print
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-07std.io.Reader: finish implementing the unit testsAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-04-27docs(std.ascii): Remove redundant three slashesShun Sakai
2024-11-29Updated ascii.zig's isWhitespace function to use switch instead of for loop. ↵Rohan Vashisht
(#22094)
2024-09-13`std.ascii`: make `toLower` `toUpper` branchless (#21369)CrazyboyQCD
Co-authored-by: WX\shixi <shixi1@cnwxsoft.com>
2024-07-02Rename isASCII to isAsciiMichael Bradshaw
2024-03-21std: promote tests to doctestsAndrew Kelley
Now these show up as "example usage" in generated documentation.
2023-06-16migration: std.math.{min, min3, max, max3} -> `@min` & `@max`r00ster91
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2022-12-09std.ascii: more testsr00ster91
2022-12-09isHex, isAlphanumeric: prong reorderr00ster91
On x86 interestingly I can see a reduction in codesize by 1 instruction with this. While not necessarily faster, it might still reduce codesize a bit and this ordering is also more logical because it follows ASCII table order. Rust's std uses this ordering too. See https://zig.godbolt.org/z/PqodY8YqY for the difference.
2022-12-09fix(perf): remove LUTr00ster91
This makes it so that we no longer use a LUT (Look-Up Table): * The code is much simpler and easier to understand now. * Using a LUT means we rely on a warm cache. Relying on the cache like this results in inconsistent performance and in many cases codegen will be worse. Also as @topolarity once pointed out, in some cases while it seems like the code may branch, it actually doesn't: https://github.com/ziglang/zig/pull/11629#issuecomment-1213641429 * Other languages' standard libraries don't do this either. JFF I wanted to see what other languages codegen compared to us now: https://rust.godbolt.org/z/Te4ax9Edf, https://zig.godbolt.org/z/nTbYedWKv So we are pretty much on par or better than other languages now.
2022-12-09docs: minor improvementsr00ster91
2022-12-09api(std.ascii): remove deprecated declsr00ster91
2022-10-29Fix deprecation docs for isAlpha and isCntrlfn ⌃ ⌥
2022-10-28Enhance indexOfIgnoreCase with Boyer-Moore-Horspool algorithmZhora Trush
2022-08-17fix: commentsr00ster91
2022-08-17api: deprecate lowercase control_code constsr00ster91
2022-08-16docs: fixes and improvementsr00ster91
2022-08-14api: deprecate `isPunct` toor00ster91
See https://github.com/ziglang/zig/issues/8419#issuecomment-843719898
2022-08-14docs: remove some hyphensr00ster91
2022-08-14fix: add missing 'o'r00ster91
2022-08-14fix: remove outdated TODOr00ster91
It was supposed to be removed: https://github.com/ziglang/zig/commit/490654c332f2d8eaf7edffa35ea0523800df998d#r47643278
2022-08-14test: update and add more testsr00ster91
2022-08-14docs: add more docsr00ster91
And improve some existing docs.
2022-08-14api: rename and deprecate a bunch of functionsr00ster91
`isAlNum` and `isAlpha`: 1. I think these names are a bit cryptic. 2. `isAlpha` is a bit ambiguous: is it alpha*numeric* or alpha*betic*? This is why I renamed `isAlpha` to `isAlphabetic`. 3. For consistency and because `isAlNum` looks weird, I renamed it to `isAlphanumeric`. `isCntrl`: 1. It's cryptic and hard to find when you look for it. 2. We don't save a lot of space writing it this way. 3. It's closer to the name of the `control_code` struct. `isSpace`: 1. The name is ambiguous and misleading. `spaces`: 1. Ditto `isXDigit`: 1. The name is extremely cryptic. 2. The function is very hard to find by its name.
2022-08-14api: deprecate `isBlank` and `isGraph`.r00ster91
I think `isBlank` and `isWhitespace` are quite confusable. What `isBlank` does is so simple that you can just do the `c == ' ' or c == '\t'` check yourself but in a lot of cases you don't even want that. `std.ascii` can't really know what you think "blank" means. That's why I think it's better to remove it. And again, it seems ambiguous considering that we have `isWhitespace`. Next, it also deprecates `isGraph`. It's the same as `isPrint(c) and c != ' '`, which I find confusing. When something is printable, you can say it also has a *graph*ical representation. Removing `isGraph` solves this possible confusion.
2022-08-14fix: off-by-one in `isCntrl`r00ster91
0x1F (`control_code.us`) itself is also a control code.
2022-08-14feat: new `control_code`r00ster91
It lowercases all constants and documents them.
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-08add allocation free versions of lower/upper stringxackus
Co-authored-by: LemonBoy <thatlemon@gmail.com> Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-02-27std.ascii: add lessThanIgnoreCase and orderIgnoreCaseAndrew Kelley
For sorting ascii strings, case insensitively.
2020-12-31Year++Frank Denis
2020-12-04std: Add a few helpers for matching ascii strings (#7300)LemonBoy
* startsWithIgnoreCase * endsWithIgnoreCase
2020-11-02std/ascii: add spaces arrayIsaac Freund
This may be combined with std.mem.trim to form a proper replacement for the now deprecated std.fmt.trimWhitespace().
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-05-16Creates `std.ascii.control_code` that contains the C0 control codes as named ↵Felix (xq) Queißner
constants.
2020-05-12Remove redundant ASCII functionsGreg Anders
The `matchCase` variants are simply duplicates of the `eql` and `indexOf` functions found in std.mem.
2020-05-11Add helper functions and docstrings to ascii.zigGreg Anders
* Add an upper case variant of `allocLowerString` * Add case-sensitive variants of `eqlIgnoreCase`, `indexOfIgnoreCase`, and `indexOfIgnoreCasePos` * Add and update docstrings on functions
2020-02-12Switch a bunch of FBA to use testing.allocatorBenjamin Feng
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221