Answer the question
In order to leave comments, you need to log in
How to find the number and position of a character in a string (javascript)?
There are such strings (or an array of objects) of 96 characters:
000000000000000000000011111111111111100000000000000000000000000000111111111111111111111111111111
000000000000000000000000000000001111111111111111000000001111111111111111111111110000000000000000
000000000000000000000000000000001111111111111111111111111111110000000222222222222222200000000000
var str = '000000000000000000000000000000001111111111111111111111111111110000000222222222222222200000000000';
Что должно получиться:
zero: [
{
startPos: 0,
count: 33
}, {
startPos: 63,
count: 7
}, {
startPos: 86,
count: 11
}
],
one: [
{
startPos: 33,
count: 30
}
],
two: [
{
startPos: 70,
count: 16
}
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question