Question: i have an array of object. every object has a date. I want to create a new array of object, grouping by weeks. here is some code example:

```
const data = [
  {
    "id": 1,
    "status": 1,
    "createdAt": "2022-05-01T08:28:36.284Z"
  },
  {
    "id": 2,
    "status": 2,
    "createdAt": "2022-05-02T07:17:11.724Z"
  },
  {
    "id": 3,
    "status": 3,
    "createdAt": "2022-05-10T07:03:44.465Z"
  },
  {
    "id": 4,
    "status": 3,
    "createdAt": "2022-05-11T16:17:48.863Z"
  }
]

```

The result I want Is an array that divides object by weeks like:

```
const newData = [
  {
    "week": 1,
    "status": 1,
    "status": 2
  },
  {
    "week": 2,
    "status": 3,
    "status": 3
  }]

```

is it possible? can I have same property 2 times in the same object?
thank you

Answer: 
You're misunderstanding `count`, the third parameter.

* What you thought it means: Limit the **haystack** - limit the number of characters of `token` to search.
* What it actually means: Limit the **needle** - limit the of characters of `option_name_valid_chars` to consider.

What you should do is:

1. create a [`string_view`](https://en.cppreference.com/w/cpp/string/basic_string_view) of your substring of interest (this requires C++17; otherwise you could make a copy with the `token.substr(...)`)
2. Search your substring without specifying the count.
3. Check against `npos`.
As written in CPP reference [here](https://en.cppreference.com/w/cpp/string/basic_string/find_first_not_of):

> 
> Finds the first character equal to none of the characters in the given character sequence. The search considers only the interval [pos, size()). If the character is not present in the interval, npos will be returned.
> 
> 
> 

In version 2 of the function, you may specify the count of you characters for comparison. So, in your case 1. With that, you will not compare to

```
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"_-"

```

but only to 'A'.

And so, 0 will be returned, since 0 is the index of the first none 'a' character.

Remove the count. Then it will work.