Getting a substring 2 characters at a time

googleuit322

New Member
I have a string that looks something like:\[code\]0122031203\[/code\]I want to be able to parse it and add the following into a list:\[code\]0122031203\[/code\]So, I need to get each 2 characters and extract them.I tried this:\[code\] List<string> mList = new List<string>(); for (int i = 0; i < _CAUSE.Length; i=i+2) { mList.Add(_CAUSE.Substring(i, _CAUSE.Length)); } return mList;\[/code\]but something is not right here, I keep getting the following:\[quote\] Index and length must refer to a location within the string. Parameter name: length\[/quote\]Did I get this wrong?
 
Back
Top