Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
char xCalcChar; //a variable to store the character that we are inspecting xCalcChar = name.charAt(nameCharAt); //do the first character inspection // following loop(s) check for any Xs in the user name, going through each char in the user name until // it finds one. whereupon it makes the value anyXsInName equal to true. if ((xCalcChar == 'x') || (xCalcChar == 'X')) //initial first check as xCalcChar already has a value { anyXsInName = true; //this indicates that there are Xs in the user's name } // if previous loop returns false, then ogo through the following if the length of the name is greater //than xCalcIn and there are no Xs found else if ((nameLength > nameCalcInt) && (anyXsInName == false)) { do { nameCalcInt++; //increment the calculation integer which makes sure that the loop only runs as //many times as the name is long nameCharAt++; //increment the value which makes charAt take the next char in the name xCalcChar = name.charAt(nameCharAt); //inspect the next character if ((xCalcChar == 'x') || (xCalcChar == 'X')) //check for those Xs again { anyXsInName = true; //this indicates that there are Xs in the name } } while ((nameLength > nameCalcInt) && (anyXsInName == false)); // preform loop until either the lenght of the name is smaller than xCalcInt or there are Xs in the //name as returned by anyXsInName }
This paste will be private.
From the Design Piracy series on my blog: