Unit Testing for CheckForTextNumber in C++

We need a function called checkForTextNumber that finds numbers like the following:
one million
two hundred
nineteen thousand five hundred
twenty-five billion

I am trying this code:
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
static auto istextnumber = [](char *&prevPtr, char *&p)->bool
	{
		// Modified by Kewei, added several new currency units
		static const string numbers[] = { // make sure the longer version is first
			"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten","eleven",
			"twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty",
			"thirty","forty","fifty","sixty","seventy","eighty","ninety","hundred"
		};

		for (const string &TEXTnumbers : numbers) {

			const string::size_type lennumbers = TEXTnumbers.length();

			if (strncmp(p, TEXTnumbers.c_str(), lennumbers) == 0) {
				if (*prevPtr == TheSpace) {
				char *const pEndOfnumbers = p + lennumbers;
				if (*pEndOfnumbers == TheSpace||*pEndOfnumbers == TheDash) {
					advance(prevPtr, p, lennumbers);
					return true;
					}
				}
			}
		}

		return false;
	};
As a begginer myself I would love to have it explained. Is it even C++ ?
1
2
3
static auto istextnumber = [](char *&prevPtr, char *&p)->bool { 
                          /\                           /\
                          || ??                        ||  ??
Topic archived. No new replies allowed.