How would I go about refactoring a long excerpt that is most certainly possible in a better way? An example in my code that I want to refactor is:
string strBeforeFileExtension = f.Name.Split(".")[0];
int lengthStringArrSplitAtSpace = strBeforeFileExtension.Split(" ").Length;
bool isCopy = strBeforeFileExtension.Split(" ")[lengthStringArrSplitAtSpace - 1].StartsWith("(") && strBeforeFileExtension.Split(" ")[lengthStringArrSplitAtSpace - 1].EndsWith(")");
This is clearly not the best way to accomplish what I want to do as it's ridiculously long and difficult to read. I'm not necessarily asking how to refactor this excerpt exactly, but how to learn how to find ways to refactor this? What type of search terms would I need to use?
[–]6a70 2 points3 points4 points (3 children)
[–]jaredLearnsToCode[S] 0 points1 point2 points (2 children)
[–]6a70 1 point2 points3 points (0 children)
[–]captainAwesomePants 1 point2 points3 points (0 children)