mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-20 19:20:45 +08:00
Add xy_str_start_with() and xy_str_delete_prefix()
This commit is contained in:
14
test_xy.c
14
test_xy.c
@@ -2,7 +2,7 @@
|
||||
* File : test_xy.c
|
||||
* Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created on : <2023-08-30>
|
||||
* Last modified : <2023-09-04>
|
||||
* Last modified : <2023-09-05>
|
||||
*
|
||||
* test_xy:
|
||||
*
|
||||
@@ -31,11 +31,23 @@ main (int argc, char const *argv[])
|
||||
putb(xy_str_end_with("abcdef", "abcdef")); // true
|
||||
putb(xy_str_end_with("abcdef", "")); // true
|
||||
|
||||
putb(xy_str_start_with("abcdef", "abcdefg")); // false
|
||||
putb(xy_str_start_with("abcdef", "abc")); // true
|
||||
putb(xy_str_start_with("abcdef", "abcde")); // true
|
||||
putb(xy_str_start_with("abcdef", "abcdef")); // true
|
||||
putb(xy_str_start_with("abcdef", "")); // true
|
||||
|
||||
puts(xy_str_delete_suffix("abcdefg", "cdef")); // 不变
|
||||
puts(xy_str_delete_suffix("abcdefg", "cdefgh"));// 不变
|
||||
puts(xy_str_delete_suffix("abcdefg", "")); // 不变
|
||||
puts(xy_str_delete_suffix("abcdefg", "efg")); // abcd
|
||||
|
||||
|
||||
puts(xy_str_delete_prefix("abcdefg", "cdef")); // 不变
|
||||
puts(xy_str_delete_prefix("abcdefg", "0abcde"));// 不变
|
||||
puts(xy_str_delete_prefix("abcdefg", "")); // 不变
|
||||
puts(xy_str_delete_prefix("abcdefg", "abc")); // defg
|
||||
|
||||
xy_success("成功:输出成功内容");
|
||||
xy_info("信息: 输出信息内容");
|
||||
xy_warn("警告:输出警告内容");
|
||||
|
||||
Reference in New Issue
Block a user