Code:
int index = -1; string NewStr = null; char[] lower = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; char[] upper = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; foreach (char c in str) { index = str.IndexOfAny(lower); if (index == -1) { index = str.IndexOfAny(upper); } NewStr = str.Remove(index, 1); }
However, it reuses the same string the entire time, never updating the string so it always finds the same (first) character.
Any help on figuring this out?
Comment