Sunday, October 12, 2008

OSD600 Week 6 Lab

Alright, I've finally gotten around to doing the OSD600 lab for this week. My patch can be found here...

https://landfill.bugzilla.org/bugzilla-3.0-branch/show_bug.cgi?id=6838

Code changes are as follows:

if (inString.FindChar('.', pos) != kNotFound
&& inString.CharAt(0) != '.'
&& inString.CharAt(inString.Length() - 1) != '.'
&& inString.Find("..", 0) == kNotFound)
{
aOutString.AssignLiteral("mailto:");
aOutString += aInString;
}

I left in the check for a "." after the @ symbol. I then check to see if there's no "." after the @. Don't really want someone typing in a@.com. Then I check to see if there's a "." at the end of the string. Finally, a check is made to see if there's any duplicate "."'s side by side. For example: "a@a..b".

If all of those things check out then it's a mailing address.

The hint given for this lab made everything easy. I just opened the CPP file listed, and looked for mailto:. Once I found it, I just made the changes that I thought were appropriate, rebuilt, and tested it.

Filing a bugzilla bug was pretty straight forward and easy as well.

2 comments:

Samer Ziadeh said...

if you wanna put code snippet, the way I do them is I put them in a blockquote and pre tags so the code will look fine with indentation :)

Scott said...

Ah thanks for the info. :)