String evensRemoved = "";
String str = reversedNames[1];
String noSpaces = str.replace(" ","");
int strlength = noSpaces.length();
for(int i = 0; i <= strlength; i++){
if(i % 2 == 0){
StringBuilder sb = new StringBuilder(noSpaces);
sb.deleteCharAt(i);
String result = sb.toString();
return result;
}
}
return "";
I want to be able to remove letters at even positions throughout the string completely, and then return the string to the original method. I've looked at other solutions and haven't been able to figure it out at all. New to Java.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…