c# - Looking for a tag in a txt doc -
ok tried things sugested, still not working me. not sure why not kick out output , it puts out put not right. doing wrong.
inputbox = input.text; int x = 1; var lines = input.text.split(new string[] { environment.newline },stringsplitoptions.none); (var index = 0; index < lines.length; index++) { var line = lines[index]; { x++; system.console.writeline("'{0}'", inputbox); bool test1 = inputbox.startswith("11600"); bool test2 = inputbox.endswith("("); if (test1 && test2) { int first = inputbox.indexof("11600"); int last = inputbox.lastindexof("("); inputbox = inputbox.substring(first, last - first); } } while (x < 50); system.console.writeline("'{0}'", line); if ((line.startswith("11600") && line.endswith("("))) { messagebox.show("these errors in line" + index + ": " + line); break; } }
this:
inputbox = inputbox.substring(last, first - last);
probably needs this:
inputbox = inputbox.substring(first, last - first);
may need add or subtract 1 depending on whether or not want include w
or 0
. run in debugger see actual numbers , should able diagnose more quickly.
Comments
Post a Comment