I have a list of numbers that is a string value using a loop I want to split this string into different variables in an array, the first of length 3 and the 6 of length 7 and the last of length 3. How can this be done using functions and loops.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- how to split a list into a given number of sub-lis
a generic way of doing this will be, if you want in a variable you can use subStringLengthMaps key, :-
Here's one way to do that:
You could map the sub strings.
We could do something like this: