Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,912
- Office Version
- 365
- Platform
- Windows
Hi
I'm trying to get to grips with M.
I have an alphanumeric string, e.g AB123C123D12
I wish to split it into {A;B;1;2;3;C;1;2;3;D;1;2}
Such that I can then manipulate elements e.g:
Return Asc code for each A-Z character so it becomes: {65;66;1;2;3;67;1;2;3;68;1;2}
Then I want to combine it and split it into single 1 char lengths again, so that it becomes {6;5;6;6;1;2;3;6;7;1;2;3;6;8;1;2}
And then finally add it up to get 65
I'm not necessarily asking for the whole function, rather just some pointers. Unsure if I have this correct but here's what I figure will split the string initially;
This is all to be contained in a function so MyString will be the function argument.
Assuming the Split function I have chosen works, the bit I am struggling with is to loop through each item to perform the manipulation.
Thanks
Jon
I'm trying to get to grips with M.
I have an alphanumeric string, e.g AB123C123D12
I wish to split it into {A;B;1;2;3;C;1;2;3;D;1;2}
Such that I can then manipulate elements e.g:
Return Asc code for each A-Z character so it becomes: {65;66;1;2;3;67;1;2;3;68;1;2}
Then I want to combine it and split it into single 1 char lengths again, so that it becomes {6;5;6;6;1;2;3;6;7;1;2;3;6;8;1;2}
And then finally add it up to get 65
I'm not necessarily asking for the whole function, rather just some pointers. Unsure if I have this correct but here's what I figure will split the string initially;
Code:
Split=Splitter.SplitTextByRepeatedLengths(1),
Chars = Split(MyString)
This is all to be contained in a function so MyString will be the function argument.
Assuming the Split function I have chosen works, the bit I am struggling with is to loop through each item to perform the manipulation.
Thanks
Jon