-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormalize_string.h
More file actions
34 lines (29 loc) · 910 Bytes
/
Copy pathnormalize_string.h
File metadata and controls
34 lines (29 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* normalize_string.h
*
* Description:
* given a string and a char, normalize the string
* by removing consecutive appearances of the char,
* outputting a new string.
*
* Two implementation are given:
* - Inplace, which does not require additional memory.
* - Fast, which process the input at O(n) but requires an additional memory (O(n)).
*
* Both implementations output 3 results:
* - Normalized string.
* - Updated string length.
* - The number of characters removed.
*
* Created on: Nov 15, 2014
* Author: edwardh
*/
#ifndef NORMALIZE_STRING_H_
#define NORMALIZE_STRING_H_
class Normalizer
{
public:
static unsigned int normalize_string_inplace(char * string, size_t& string_len, const char norm_char);
static unsigned int normalize_string_fast(const char *src_string, char *dst_string, size_t& string_len, const char norm_char);
};
#endif /* NORMALIZE_STRING_H_ */