About this question
I have a requirement where I need to split a string into a list of substrings with size 2 that is for example,
String = 'ABCDEF J4' and I want the output as
ListsubStringList = {'AB', 'CD', 'EF','J4'} I have tried it in javascript with the following :
var chunkStr = function(str, chunkLength) {
return str.match(new RegExp('[\s\S]{1,' + +chunkLength + '}', 'g'));
}
I am not sure how to achieve the same in apex. Could someone please point me in the right direction.