I have to maintain code from a contractor. It has this "interesting" snippet:
String webServicesValue =
webResponse.substring(webResponse.indexOf("<" + fieldName + ">") +
fieldName.length() + 2,
webResponse.indexOf("</" + fieldName + ">"));
It took me a few minutes to understand what he's trying to do.
It seems to be a WTF code, but my colleague suggested, "If it ain't broken, don't fix it." I'm wondering if this code will ever fail. It seems to be working so far, and I honestly can't think of a test case to fail this.
Thanks,