| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
It's still shorter than the complete email regex...
|
|
frist!
Okay, I have a very similar procedure, but it's nowhere near that complicated. but if it works, it works. |
Re: The Complicator's Email Address Parser
2009-04-06 09:03
•
by
Fisty Mc Fistassin
(unregistered)
|
|
Holy Shit! How did I get beaten!
Third FIST! |
Re: The Complicator's Email Address Parser
2009-04-06 09:06
•
by
Greg
(unregistered)
|
|
Oh yeah. Reminds me of the time I found&removed a 300 line strong method that was supposed to check if the difference between a given date and "now" exceeds 18 years (an enterprisey java "are you over 18?" check)
|
|
You gol-danged whipper-snapper kids and your uppity "methods" should shut up and learn the REAL way to code, like we did back in the day! Ha, "split", you're just begging for trouble by letting some fancy LIBRARY routine do the work for you, ya slacker! How do you know it will work right unless you write the code yourself?? Huh?? Got no answer for that, do you, Mister Smarty-Pants!
|
Re: The Complicator's Email Address Parser
2009-04-06 09:12
•
by
Anonymous
(unregistered)
|
|
I was thinking, hey I know the guy who wrote this but then I realized it was missing his trademark
... if (doneCur == true) |
Re: The Complicator's Email Address Parser
2009-04-06 09:17
•
by
Inhibeo
(unregistered)
|
if (allDone) How zen. |
|
Sure, it's a WTF. I'm not gonna say it's not a WTF.
But these modern day compiler libraries are so incredibly large, it's impossible to know, and understand, and be able to use, every single call that's included. It would take years, if not decades, for a programmer to get to know all the ins and outs of a given library. And then in the end, when he knows everything, he'll find that his knowledge is outdated and there are newer versions of the libraries with different functionalities. So the best you can aspire to is to learn a decent subset of the calls at your disposal, and to use those to the best of your abilities. If, at every routine I'm writing, I were to think, hey, maybe there's an API call somewhere that does the same thing; why don't I just launch a quick internet search and spend the afternoon surfing across msdn.microsoft.com, my programs would take much longer to write, even if they would end up marginally smaller. |
Re: The Complicator's Email Address Parser
2009-04-06 09:24
•
by
Rollerscopter
(unregistered)
|
|
Yeah right, cause string.Split() is an obscure, rarely-used method.
|
Re: The Complicator's Email Address Parser
2009-04-06 09:34
•
by
Anon
(unregistered)
|
Shouldn't that be: return emails.Split(new char[]{' ','\t',',',';',':'}); |
Re: The Complicator's Email Address Parser
2009-04-06 09:34
•
by
NoXzema
(unregistered)
|
The reason you would do this is: 1. It usually doesn't take as much time to find than it does to code. 2. The API function you call would end up being so much more effecient even if it were a little time loss. 3. It would make your code so much more enjoyable to read and have already placed documentation (most of the time). |
Re: The Complicator's Email Address Parser
2009-04-06 09:35
•
by
sagaciter (rocking the captchah, rocking the captchah...)
(unregistered)
|
|
This is typical of Java mistraining:
- some manager thaught that this new-fangled java thing is cool, let's train the dev's on it, etc. etc. - the a st**pid fail-training train comes, and gives the course on java as a _language_ alone (look ma, garbage collection, weak references, whohoo !), when actually knowing what's inside the java libraries should be 4/5 of it. (sigh...) been there, seen that, should have created a tee-shirt, would be rich by now. |
Re: The Complicator's Email Address Parser
2009-04-06 09:35
•
by
Abraham Maslow
(unregistered)
|
|
He that is good with a hammer tends to think everything is a nail.
|
Re: The Complicator's Email Address Parser
2009-04-06 09:35
•
by
Mike
(unregistered)
|
|
Speed up loop?
for (i = 0; i < len; i++) { char ch = emails[i]; } |
Re: The Complicator's Email Address Parser
2009-04-06 09:35
•
by
Anon
(unregistered)
|
Ok, that's more readable. |
Re: The Complicator's Email Address Parser
2009-04-06 09:39
•
by
FromCanada
(unregistered)
|
|
Comment<string> comment = new Comment<string>(1);
|
Re: The Complicator's Email Address Parser
2009-04-06 09:41
•
by
Bobbo
|
The what? |
Re: The Complicator's Email Address Parser
2009-04-06 09:46
•
by
durnurd
|
You know, those two-letter words that nobody likes to see on TV. Like... I guess.... uu in this case? |
Re: The Complicator's Email Address Parser
2009-04-06 09:48
•
by
50% Opacity
(unregistered)
|
I have no idea, but I sure gonna use this one from now on. |
Re: The Complicator's Email Address Parser
2009-04-06 09:56
•
by
Abraham Maslow
(unregistered)
|
|
To the man who only has a hammer, everything he encounters begins to look like a nail.
|
Re: The Complicator's Email Address Parser
2009-04-06 09:57
•
by
Edward Royce
(unregistered)
|
Get off my lawn!! |
Re: The Complicator's Email Address Parser
2009-04-06 09:57
•
by
SCB
(unregistered)
|
stoopid |
Re: The Complicator's Email Address Parser
2009-04-06 09:57
•
by
augur
(unregistered)
|
Or: return emails.Split(" \t,;:".ToCharArray()); |
Re: The Complicator's Email Address Parser
2009-04-06 09:59
•
by
XIU
|
The argument for Split is params char[] so the call from the article is correct and the easiest to use. |
Re: The Complicator's Email Address Parser
2009-04-06 10:00
•
by
monkeyPushButton
(unregistered)
|
Thanks for making this thread not work safe. |
Re: The Complicator's Email Address Parser
2009-04-06 10:03
•
by
Edward Royce
(unregistered)
|
It's a funny thing. When I was a very young kid and having just learned the basics of English, got adopted into an American family, I spent weeks reading dictionaries from cover to cover so I could have a better understanding of the language. Yet there are professional programmers who learn the syntax of a language but don't bother furthering their understanding of all the functions and objects available for that language. strange. |
Re: The Complicator's Email Address Parser
2009-04-06 10:08
•
by
guh
(unregistered)
|
Or you could just type emails.'Ctrl-Space' |
Re: The Complicator's Email Address Parser
2009-04-06 10:12
•
by
Beldar the Phantom Replier
|
Yes, except it is then harder to read; on first glance (not had coffee yet) " \t,;:".ToCharArray() would return [' ','\','t',',',';',':'] The original is more readable and is less typing; what's not to like (unless you're a Complicator, of course)? |
Re: The Complicator's Email Address Parser
2009-04-06 10:20
•
by
Bobbo
|
Yes, but is your work thread-safe?? |
Re: The Complicator's Email Address Parser
2009-04-06 10:25
•
by
Anon
(unregistered)
|
|
FYI to all the java programmers providing solutions, the method is
and not and on top of that it doesn't take character array as an argument. |
Re: The Complicator's Email Address Parser
2009-04-06 10:26
•
by
Mr B
|
So how many of the 540,000 words in the English language do you know? Did you know that the "acnestis" is the part of the back that's impossible to scratch? No? I didn't either until I looked it up - but I managed before by saying "that bit just behind my shoulder blades that I can't scratch". OK it was a bit long winded, but in many ways it's easier to communicate with people the long-winded way, rather than using an obscure word which you'd probably end up having to explain the meaning of anyway. :) |
Re: The Complicator's Email Address Parser
2009-04-06 10:47
•
by
Dr. Evil
(unregistered)
|
Maybe so, but string.Split() is the nose on your face, not the acnestis on your back :) |
Re: The Complicator's Email Address Parser
2009-04-06 10:48
•
by
Fishbone
(unregistered)
|
|
i could be wrong, but i don't think, that
"List<string> list = new List<string>(1);" would compile at all... List is an Interface and thus is not instantiable. |
Re: The Complicator's Email Address Parser
2009-04-06 10:48
•
by
Tim
(unregistered)
|
|
I'm pretty sure this is C# code, not Java.
I don't know C# - can you really call a function that takes a Char[] by passing the chars as separate parameters? How does it deal with this: void func(Char[] foo); void func(Char a, Char b); ... func('a', 'b'); |
You make Fuhrer angry. |
Re: The Complicator's Email Address Parser
2009-04-06 10:50
•
by
Fishbone
(unregistered)
|
ok, that would render my comment useless... |
Re: The Complicator's Email Address Parser
2009-04-06 10:51
•
by
Steve
(unregistered)
|
|
It's C#, you can use List<string>, IList is the interface.
|
Re: The Complicator's Email Address Parser
2009-04-06 10:52
•
by
Lol Lolovici
(unregistered)
|
So are you saying that it's easier when you talk to people to say "Moses did that action that applied to an object creates several subparts of that object to the waters" instead of "Moses split the waters"? |
Re: The Complicator's Email Address Parser
2009-04-06 10:52
•
by
Bart
(unregistered)
|
|
A "decent subset" of the Java library should include String.split, or it is not "decent".
Learning all of the libraries for a language such as Java is not feasible; however, any developer should imho try to constantly expand the tools (i.e. the "decent subset of calls" ) at his disposal. If what you are trying to code seems like something that _should_ be in a library, chances are it _is_ in the library, but you just did not find it yet. |
Re: The Complicator's Email Address Parser
2009-04-06 10:55
•
by
Joe
(unregistered)
|
Except '\t' is a tab character. I guess you could verbatim the string (@".."); but, string -> char[] is not the best way anyhow. I'm not going to hate-on splitting a string to char[] since it is useful in some cases. This is not one of those cases. You sir, are The Complicator. "new char[] { ... }" is the way to go. |
Re: The Complicator's Email Address Parser
2009-04-06 10:57
•
by
jcs
(unregistered)
|
|
Wake up people...this is obviously C#, not Java! The uppercase method names should have given it away.
|
Re: The Complicator's Email Address Parser
2009-04-06 10:58
•
by
jcs
(unregistered)
|
|
Tim: You cannot do that -- you must actually create an array.
|
Re: The Complicator's Email Address Parser
2009-04-06 10:58
•
by
abx
|
in C#, if the signature is: func(params char[] foo); the params keyword allows you to invoke it by passing the chars as separate parameters, and you treat it as an array inside the function. func('a','b'); will invoke the signature that explicitly matches your call, but func('a','b','c') will invoke the overload with the params keyword. |
Re: The Complicator's Email Address Parser
2009-04-06 11:01
•
by
jcs
(unregistered)
|
|
To the "programmers" who complain that the class libraries are too large for them to discover functions like String.Split ... nobody's asking you to memorize the entire class library, but every programmer SHOULD be familiar with the most fundamental classes in the library (such as Object, String, and the collections framework) and the methods that are available for these classes.
If you can't even be bothered to learn the methods for String (one of the most commonly used classes in the language), then why is your employer paying you again? |
Re: The Complicator's Email Address Parser
2009-04-06 11:03
•
by
Salami
|
|
Because the employer charges the customer by the hour and/or lines of code?
|
Re: The Complicator's Email Address Parser
2009-04-06 11:03
•
by
Anon
(unregistered)
|
No. I pretty sure you can't. Hence why it should be func(new char[]{....}); |
Re: The Complicator's Email Address Parser
2009-04-06 11:03
•
by
B Pappin
(unregistered)
|
|
Well, at least its easy to write a test and refactor all those method by method until your done. It could be worse.
|
Re: The Complicator's Email Address Parser
2009-04-06 11:06
•
by
diaphanein
(unregistered)
|
If foo is marked with "params", yes. It's C# implementation of variable length arguments. http://msdn.microsoft.com/en-us/library/w5zay9db.aspx Which overload called is dependent upon how its invoked. func('a', 'b') will call the second. func(new char[]{'a', 'b'}) with call the first. |
Re: The Complicator's Email Address Parser
2009-04-06 11:13
•
by
A. Friend
(unregistered)
|
Shouldn't that be st??pid, st*pid |
|
Must be amateur hour on TDWTF.
This is a rookie mistake, but also an understandable one. I'm going to guess the guy who wrote this came from a background full of languages with crap libraries, and so it didn't even occur to him that somebody might have solved his problem in advance. Now if this guy was an experienced C# (is that it?) dev, then yeah, it becomes a WTF, though not a colossal one. I was kind of hoping for this guy to be the Director of IT or something and mandate that all libraries have to be re-implemented internally because "Microsoft isn't any good." |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |