Add blank spaces in a string for input value


#1

I’m trying to add spaces to my input value while the user is typing. I couldn’t manage to add space after certain digits dynamically. I apply the blocks (mentioned in the example) based on input length

for example

Input: 1234567890
blocks: [3,3,4]
expected output: 123 456 7890
input: 123456789021
blocks: [3,2,2,5]
expected output: 123 45 67 89021