@@ -3080,23 +3080,23 @@ test endsWith {
3080
3080
}
3081
3081
3082
3082
/// If `slice` starts with `prefix`, returns the rest of `slice` starting at `prefix.len`.
3083
- pub fn chompPrefix (comptime T : type , slice : []const T , prefix : []const T ) ? []const T {
3083
+ pub fn cutPrefix (comptime T : type , slice : []const T , prefix : []const T ) ? []const T {
3084
3084
return if (startsWith (T , slice , prefix )) slice [prefix .len .. ] else null ;
3085
3085
}
3086
3086
3087
- test chompPrefix {
3088
- try testing .expectEqualStrings ("foo" , chompPrefix (u8 , "--example=foo" , "--example=" ).? );
3089
- try testing .expectEqual (null , chompPrefix (u8 , "--example=foo" , "-example=" ));
3087
+ test cutPrefix {
3088
+ try testing .expectEqualStrings ("foo" , cutPrefix (u8 , "--example=foo" , "--example=" ).? );
3089
+ try testing .expectEqual (null , cutPrefix (u8 , "--example=foo" , "-example=" ));
3090
3090
}
3091
3091
3092
3092
/// If `slice` ends with `suffix`, returns `slice` from beginning to start of `suffix`.
3093
- pub fn chompSuffix (comptime T : type , slice : []const T , suffix : []const T ) ? []const T {
3093
+ pub fn cutSuffix (comptime T : type , slice : []const T , suffix : []const T ) ? []const T {
3094
3094
return if (endsWith (T , slice , suffix )) slice [0 .. slice .len - suffix .len ] else null ;
3095
3095
}
3096
3096
3097
- test chompSuffix {
3098
- try testing .expectEqualStrings ("foo" , chompSuffix (u8 , "foobar" , "bar" ).? );
3099
- try testing .expectEqual (null , chompSuffix (u8 , "foobar" , "baz" ));
3097
+ test cutSuffix {
3098
+ try testing .expectEqualStrings ("foo" , cutSuffix (u8 , "foobar" , "bar" ).? );
3099
+ try testing .expectEqual (null , cutSuffix (u8 , "foobar" , "baz" ));
3100
3100
}
3101
3101
3102
3102
/// Delimiter type for tokenization and splitting operations.
0 commit comments