"My official title is Junior Developer," writes J Banic, "but I've come to become known as The Shortcut Guy. Why? Because I tend to know a lot of 'shortcuts' that the mid- and senior-level developers haven't yet discovered."

"To give you an idea at the type of 'shortcuts' I help them with, following is an instant message exchange between me ('jbanic') and a colleague ('mroot')."

mroot (10:03 AM): Got a problem for ya...
mroot (10:03 AM): Any idea how I can parse a string of email addresses like this: [email protected]@[email protected]?
mroot (10:04 AM): I need them separated in an array. I was thining of looking for .net, .com, etc.
jbanic (10:05 AM): That's not really feasible... you'd have to know *all* existing domains.
mroot: (10:05 AM): Is there a web service to do that?
jbanic (10:06 AM): Ehhh... no.
mroot: (11:18 AM): Okay. What if there was a comma between the addresses? For example, [email protected],[email protected],[email protected].
mroot: (11:19 AM): That should be easy to put in an array?
jbanic (11:22 AM): Waitasec... how did you add in the comma like that!?
mroot: (11:24 AM): I just copy/pasted them from debug console. That's what my string has.
jbanic (11:25 AM): Hmm... can you send me the code?
mroot: (11:25 AM): Sure, no problem...
mroot: (11:25 AM): Here it is.
       PreparedStatement ps  = connection.prepareStatement("SELECT * FROM email_contact");
       ResultSet rs = ps.executeQuery();
       if (rs.next()) {
            String email = rs.getString("email");
jbanic signed off.

"After regaining my cool, I explained to him that he could simply put it in a List, and convert it to an array. Not surpisingly, he replied with 'that's a pretty neat shortcut!'"

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!