authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-16 17:20:25+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-12-09 21:57:17+01:00
log626e02a429218fd194111320057fc4f2e8ceecda
tree9a543138b06385ab5cecb3ec4aec53dce6e58c5f
parent6b7d9b34e8fcefa731800cef883c2400f9f39de5

docs: minor improvements


1 files changed, 7 insertions(+), 7 deletions(-)

lib/std/ascii.zig+7-7
......@@ -254,7 +254,7 @@ pub fn isLower(c: u8) bool {
254254 return inTable(c, tIndex.Lower);
255255}
256256
257/// Returns whether the character has some graphical representation and can be printed.
257/// Returns whether the character is printable and has some graphical representation.
258258/// This also returns `true` for the space character.
259259/// This is the same as `!isControl(c)`.
260260pub fn isPrint(c: u8) bool {
......@@ -286,7 +286,7 @@ pub fn isUpper(c: u8) bool {
286286 return inTable(c, tIndex.Upper);
287287}
288288
289/// Returns whether the character is a hexadecimal digit. This is case-insensitive.
289/// Returns whether the character is a hexadecimal digit. Case-insensitive.
290290pub fn isHex(c: u8) bool {
291291 return inTable(c, tIndex.Hex);
292292}
......@@ -296,7 +296,7 @@ pub fn isASCII(c: u8) bool {
296296 return c < 128;
297297}
298298
299/// Uppercases the character and returns it as-is if it's already uppercased or not a letter.
299/// Uppercases the character and returns it as-is if already uppercase or not a letter.
300300pub fn toUpper(c: u8) u8 {
301301 if (isLower(c)) {
302302 return c & 0b11011111;
......@@ -305,7 +305,7 @@ pub fn toUpper(c: u8) u8 {
305305 }
306306}
307307
308/// Lowercases the character and returns it as-is if it's already lowercased or not a letter.
308/// Lowercases the character and returns it as-is if already lowercase or not a letter.
309309pub fn toLower(c: u8) u8 {
310310 if (isUpper(c)) {
311311 return c | 0b00100000;
......@@ -314,7 +314,7 @@ pub fn toLower(c: u8) u8 {
314314 }
315315}
316316
317test "ascii character classes" {
317test "ASCII character classes" {
318318 const testing = std.testing;
319319
320320 try testing.expect(!isControl('a'));
......@@ -440,7 +440,7 @@ pub fn startsWithIgnoreCase(haystack: []const u8, needle: []const u8) bool {
440440 return if (needle.len > haystack.len) false else eqlIgnoreCase(haystack[0..needle.len], needle);
441441}
442442
443test "ascii.startsWithIgnoreCase" {
443test "startsWithIgnoreCase" {
444444 try std.testing.expect(startsWithIgnoreCase("boB", "Bo"));
445445 try std.testing.expect(!startsWithIgnoreCase("Needle in hAyStAcK", "haystack"));
446446}
......@@ -449,7 +449,7 @@ pub fn endsWithIgnoreCase(haystack: []const u8, needle: []const u8) bool {
449449 return if (needle.len > haystack.len) false else eqlIgnoreCase(haystack[haystack.len - needle.len ..], needle);
450450}
451451
452test "ascii.endsWithIgnoreCase" {
452test "endsWithIgnoreCase" {
453453 try std.testing.expect(endsWithIgnoreCase("Needle in HaYsTaCk", "haystack"));
454454 try std.testing.expect(!endsWithIgnoreCase("BoB", "Bo"));
455455}