String is only digits in convoluted c#
-
<FONT size=2 face=Consolas><FONT size=2 face=Consolas>
Came across the following crap while making changes to a module written by one of the devs. Called him right and gave him the 'shame on you for writing this crap as production code!' -- 'but it works!' -- 'it's f***in unmaintainable.'
Bonus: it was obviously inline code sprinkled somewhere in the module.</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>var</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> digits = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>new</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> </FONT></FONT><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas><FONT color=#2b91af size=2 face=Consolas>List</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas><</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>string</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>>() { </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"0"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"1"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"2"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"3"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"4"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"5"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"6"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"7"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"8"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>, </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>"9"</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> };
</FONT></FONT>
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>int</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> pos = 0;
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>bool</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> b = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>false</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>for</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>int</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> i = 0; i < fphone.Length; i++)
{
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>string</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> s = fphone.Substring(pos, 1);
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas> bool</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> x = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>false</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>foreach</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>string</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> c </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>in</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> digits)
</FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>{
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>if</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (s == c)
{
pos = pos + 1;
x = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>true</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>break</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
</FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>}
}
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>if</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (x == </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>false</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>)
{
b = </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>true</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>break</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
}
}
</FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>if</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> (b == </FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>true</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>)
fphone = </FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>""</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>;
-
That's dumb. Everybody knows you're supposed to convert it to a number and make sure it's between 100000000 and 9999999999.
-
/^\d+$/.test(fphone)
-
He is checking if the string contains only digits, and it seems like a regex like "[0-9]" was too much for him.
-
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-
@dhromed said:
/^\d+$/.test(fphone)
for (double i = Math.pow(10, fphone.length() - 1); i < Math.pow(10, fphone.length()); ++i) {
if (fphone.equals(Double.toString(i)) {
return true;
}
}
return false;
-
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have /([2-9]|[1-9][0-9]*)/ problems.
-
@Welbog said:
@pbean said:
Agreed. TRWTF is not precompiling the regex to enable efficient reuse.
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-
@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
-
@dhromed said:
I'm going to grab a sandwich.
I already have a sandwich. I picked it up at Canterbury Commons.
-
@dhromed said:
Some people, when confronted with a problem, think "I'm going to grab a sandwich." Now they have two problems because the sandwich is poisoned.@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
-
You regex maniacs! I have a lot of more ways to do this:
//use your favorite type of data, probably integer will not work integer p if (integer.tryparse(fphone,p)) { //it's a phone number!!! }
//another
integer p
Try
{
p = integer.parse(fphone)
}
[Fixed your lack of markup. -bs]
-
@bstorer said:
@dhromed said:
Some people, when confronted with a problem, think "I'm going to grab a sandwich." Now they have two problems because the sandwich is poisoned.@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.
-
@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when confronted with an over-used Zawinksi quote, think "I know, I'll use flaming." Now they have two problems.
-
@morbiuswilters said:
Some people, when confronted with a dhromed making love to a sandwich, think "I know, I'll eat that sandwich." Now they have two problems because it turns out that they're btk. Also the poison; so I guess it's actually 3 problems.@bstorer said:
@dhromed said:
Some people, when confronted with a problem, think "I'm going to grab a sandwich." Now they have two problems because the sandwich is poisoned.@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.
-
ok i'm not coming back to this forum
-
@adi_drumea said:
ok i'm not coming back to this forum
Good going, Welbog. Way to scare off another one. Jerk.
-
@bstorer said:
@morbiuswilters said:
Some people, when confronted with a dhromed making love to a sandwich, think "I know, I'll eat that sandwich." Now they have two problems because it turns out that they're btk. Also the poison; so I guess it's actually 3 problems.@bstorer said:
@dhromed said:
Some people, when confronted with a problem, think "I'm going to grab a sandwich." Now they have two problems because the sandwich is poisoned.@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.
Some people, when observing a quote pyramid forming, add to it.
-
-
@adi_drumea said:
ok i'm not coming back to this forum
Some people, when confronted with humor, think "I know, I'll leave for good!" Now the rest of us have no problems.
-
@dhromed said:
@adi_drumea said:
Some people have problems.ok i'm not coming back to this forum
WHY DO YOU HATE FUN
-
@bstorer said:
Some people, when confronted with dhromed making love to a sandwich and the realization that they are BTK, think "I know, I'll eat that sandwich." Now they have 4 problems because not only is the sandwich poisoned with laxatives, but its also the broodwich.@morbiuswilters said:
@bstorer said:
@dhromed said:
@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.
I'll stick with my mac & cheese thank you!
-
@galgorah said:
mac & cheese
You know, we call that Kraft Dinner in Canada.
-
@Welbog said:
@galgorah said:
Kraft doesn't want to get the hopes of Canadians up that there's more to life than their processed cheese foodstuff. Stop dreaming big; just shut your Canuck mouth and eat your Kraft Dinner.mac & cheese
You know, we call that Kraft Dinner in Canada.
-
@dhromed said:
@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a problem, think "fuck that" and grab a sandwich.
Kind of a zen approach, really.
-
@bstorer said:
Don't forget to buy all of those fancy dijon ketchups. I know that's what I'd do if I had a million dollars.@Welbog said:
@galgorah said:
Kraft doesn't want to get the hopes of Canadians up that there's more to life than their processed cheese foodstuff. Stop dreaming big; just shut your Canuck mouth and eat your Kraft Dinner.mac & cheese
You know, we call that Kraft Dinner in Canada.
-
@da Doctah said:
Kind of a zen approach, really.
Better than a Zend approach.
-
-
@dhromed said:
@smbarbour said:
I know that's what I'd do if I had $1,000,000 dollars.
BTFY.@smbarbour said:
Don't forget to buy all of those fancy dijon
DTFYketchupsdicks. I know that's what I'd do if I had a million dollars.
-
@bstorer said:
@adi_drumea said:
ok i'm not coming back to this forum
Good going, Welbog. Way to scare off another one. Jerk.And he never even told us whether his workplace ever dialled the "validated" numbers without someone checking them over first.
-
They have dijon dicks? Excellent! How many $dollars would they cost, you reckon?
-
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have /[9][9][^b][^i][^t][^c][^h][^1]/ problems.
Cudos to the first person to get it or optimize it
-
@dhromed said:
Well, as I understand it, the entire lot is $1,000,000 dollars (that's about 311340.8 kilograms for you metric folks) or less. How much less? Who can say?They have dijon dicks? Excellent! How many $dollars would they cost, you reckon?
-
me.Problems.Count == 99 && !me.Problems.Contains(Problems.Bitch)
-
@fire2k said:
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have /[9][9][^b][^i][^t][^c][^h][^1]/ problems.
Well. I guess that would have been [url=http://forums.thedailywtf.com/forums/p/17238/223998.aspx#223998]bstorer[/url] then. Cudos to you, bstorer, for preemptively getting a non obscure reference. Also, why are you declaring character classes of only one character? [9][9]? What is that? 9{2}. I'm pretty sure the rest cannot be optimized if that's exactly what you're intending on matching. There are much better methods than a regex if you're just looking to exclude a known sequence, though.Cudos to the first person to get it or optimize it
-
@toth said:
me.Problems.Count == 99 && !me.Problems.Contains(Problems.Bitch)
I don't entirely agree with your logic here. I would think Bitch would be a subclass of Problem, not some static member of a Problems class. So you have to make sure that no element of me.Problems (presumably a generic container holding Problem objects):if (me.Problems.Count < 99) { throw new BigPimpinException(); } else if (me.Problems.Count > 99) { throw new HardKnockLifeException(); } for(int i = 0; i < 99; ++i) { if (me.Problems[i] is Bitch) { throw new NiggaWhatException(); } } return true;
My C# is extremely limited, so let's all pretend that works, even if it doesn't.
-
@Xyro said:
Cudos to you, bstorer, for preemptively getting a non obscure reference.
Notice how I left it as an aside, because it wasn't funny enough on its own? Leave the comedy to the experts, people. That's why we make the $big bucks.
-
This is clearly done the wrong way. The sensible solution to this problem would be:
string digits = "0123456789";
foreach(char c in fphone) {
if(digits.IndexOf(c.ToString()) < 0) {
fphone = "";
break;
}
}[Not enough of a genius to escape angle brackets, apparently. -bs]
-
@toth said:
This is clearly done the wrong way. The sensible solution to this problem would be:
POTFYstring digits = "0123456789";
foreach(char c in fphone) {
if(digits.IndexOf(c.ToString()+1)Edit: oh, never mind.
-
@bstorer said:
@toth said:
me.Problems.Count == 99 && !me.Problems.Contains(Problems.Bitch)
I don't entirely agree with your logic here. I would think Bitch would be a subclass of Problem, not some static member of a Problems class. So you have to make sure that no element of me.Problems (presumably a generic container holding Problem objects):if (me.Problems.Count < 99) {
throw new BigPimpinException();
}
else if (me.Problems.Count > 99) {
throw new HardKnockLifeException();
}
for(int i = 0; i < 99; ++i) {
if (me.Problems[i] is Bitch) {
throw new NiggaWhatException();
}
}
return true;
My C# is extremely limited, so let's all pretend that works, even if it doesn't.
No, no, Problems is an enumeration (I know, it's ugly having an enumeration with the same name as a member). Problems.Bitch is an enumeration member (as is Problems.CreditCardPaymentPastDue and Problems.GrillMistakenlyHasUnicornsOnIt).
-
-
@toth said:
@pstorer said:
[Not enough of a genius to escape angle brackets, apparently. -bs]
Blame that on CS
Finally something in this thread I can latch on to!
-
@toth said:
No, no, Problems is an enumeration (I know, it's ugly having an enumeration with the same name as a member). Problems.Bitch is an enumeration member (as is Problems.CreditCardPaymentPastDue and Problems.GrillMistakenlyHasUnicornsOnIt).
This is awful. I need auxillary information about my problems, not just a list of the sorts of problems I'm having. If I had a Bitch problem, I'd like to know which bitch, and how she found out my real name or where I live. If I have a NiggaWantsToKillMe problem, I'd like to know which nigga, and maybe even why. If I have a GrillMistakenlyHasUnicornsOnIt problem, I want to know why this is a problem. Were the unicorns meant to be ponies? Was I switching it up and going with mermaids this month in honor of Fathers' Day? Were they just poorly made unicorns with two horns or something?I'm not looking merely to quantify these problems, but to organize and prioritize them, so I can fit them in between sessions of brushing my shoulder off.
-
@bstorer said:
@toth said:
No, no, Problems is an enumeration (I know, it's ugly having an enumeration with the same name as a member). Problems.Bitch is an enumeration member (as is Problems.CreditCardPaymentPastDue and Problems.GrillMistakenlyHasUnicornsOnIt).
This is awful. I need auxillary information about my problems, not just a list of the sorts of problems I'm having. If I had a Bitch problem, I'd like to know which bitch, and how
she found out my real name or where I live. If I have a NiggaWantsToKillMe problem, I'd like to know which nigga, and maybe even why. If I have a GrillMistakenlyHasUnicornsOnIt problem, I want to know why this is a problem. Were the unicorns meant to be ponies? Was I switching it up and going with mermaids this month in honor of Fathers' Day? Were they just poorly made unicorns with two horns or something?I'm not looking merely to quantify these problems, but to organize and
prioritize them, so I can fit them in between sessions of brushing my
shoulder off.Well then you should have included that in the requirements. I think I can fit in one or two of those changes in the next release, although it will require a new server and a subscription to PissDrinkingMidgets.com. Don't ask why, it just does.
-
@galgorah said:
@bstorer said:
Some people, when confronted with dhromed making love to a sandwich and the realization that they are BTK, think "I know, I'll eat that sandwich." Now they have 4 problems because not only is the sandwich poisoned with laxatives, but its also the broodwich.@morbiuswilters said:
@bstorer said:
@dhromed said:
@Welbog said:
@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.
I'll stick with my mac & cheese thank you!
Some people have seen Margaret Thatcher naked. They have lots of problems.
-
@galgorah said:
@bstorer said:
Some people, when confronted with the idea of eating Mac & Cheese, say "oh shit there's no meat in this! How can this be called food?" Then they throw it away and eat ham and bacon with their bare hands@morbiuswilters said:
Some people, when confronted with dhromed making love to a sandwich and the realization that they are BTK, think "I know, I'll eat that sandwich." Now they have 4 problems because not only is the sandwich poisoned with laxatives, but its also the broodwich.@bstorer said:
Some people, when confronted with a dhromed making love to a sandwich, think "I know, I'll eat that sandwich." Now they have two problems because it turns out that they're btk. Also the poison; so I guess it's actually 3 problems.@dhromed said:
Some people, when confronted with a dhromed, think "I'm going to use a poisoned sandwich." Now they have two problems because dhromed is going to "love" the sandwich, not eat it.@Welbog said:
Some people, when confronted with a problem, think "I'm going to grab a sandwich." Now they have two problems because the sandwich is poisoned.@pbean said:
Some people, in an effort to sound intelligent, quote other people. Now they look retarded.Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Some people, when--
oh fuck that.
I'm going to grab a sandwich.
I'll stick with my mac & cheese thank you!
-
I like that no one has a problem with the fact that '7' is a valid phone number in this code as well as '13543518416543874643518465435184964'.
-
@bobzilla said:
I like that no one has a problem with the fact that '7' is a valid phone number in this code as well as '13543518416543874643518465435184964'.
Please remove my phone number from this post.
-
@toth said:
This is clearly done the wrong way. The sensible solution to this problem would be:
string digits = "0123456789";
foreach(char c in fphone) {
if(digits.IndexOf(c.ToString()) < 0) {
fphone = "";
break;
}
}Sadly, I think this performs better than the regex.
The non-retarded way of doing it is
s = s.Any(c => !char.IsDigit(c)) ? "" : s
(Sorry for being too on-topic, but the actual code WTFery in this thread was just too egregious)