Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
233aabc8
Commit
233aabc8
authored
Apr 24, 2020
by
rswindell
Browse files
Add strListStripStrings().
parent
0b6132f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
src/xpdev/str_list.c
src/xpdev/str_list.c
+20
-0
src/xpdev/str_list.h
src/xpdev/str_list.h
+2
-0
No files found.
src/xpdev/str_list.c
View file @
233aabc8
...
...
@@ -778,3 +778,23 @@ int strListTruncateStrings(str_list_t list, const char* set)
}
return
i
;
}
/* Strip chars in 'set' from strings in list */
int
strListStripStrings
(
str_list_t
list
,
const
char
*
set
)
{
size_t
i
;
char
*
o
;
char
*
p
;
if
(
list
==
NULL
)
return
0
;
for
(
i
=
0
;
list
[
i
]
!=
NULL
;
i
++
)
{
for
(
o
=
p
=
list
[
i
];
(
*
p
!=
'\0'
);
p
++
)
{
if
(
strchr
(
set
,
*
p
)
==
NULL
)
*
(
o
++
)
=
*
p
;
}
*
o
=
'\0'
;
}
return
i
;
}
src/xpdev/str_list.h
View file @
233aabc8
...
...
@@ -164,6 +164,8 @@ DLLEXPORT int strListTruncateTrailingWhitespaces(str_list_t);
DLLEXPORT
int
strListTruncateTrailingLineEndings
(
str_list_t
);
/* Truncate strings in list at first occurrence of any char in 'set' */
DLLEXPORT
int
strListTruncateStrings
(
str_list_t
,
const
char
*
set
);
/* Remove all occurrences of chars in set from string in list */
DLLEXPORT
int
strListStripStrings
(
str_list_t
,
const
char
*
set
);
/************/
/* File I/O */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment