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: 
The reason of your confusion is that you are incorrectly considering the meaning of the third argument (parameter) in this call

```
auto pos = token.find_first_not_of(option_name_valid_chars, 0, 1);
                                                              ^^^

```

Actually it determines the length of the substring of the string `option_name_valid_chars`.

In fact the above call is equivalent to

```
auto pos = token.find_first_not_of( "A", 0 );

```

According to the C++ 17 Standard the method is defined the following way

> 
> size\_type find\_first\_not\_of(const charT\* s, size\_type pos, size\_type
> n) const;
> 
> 
> 4 Returns: find\_first\_not\_of(basic\_string\_view<charT, traits>(s, n),
> pos).
> 
> 
> 

As you can see the third parameter is used as the length of the string `s`,
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.