Abbreviation to full MLB team names

I do this more often than not. Just a memo. This is syntax for ActionScript 3, but I am sure it can be used for many other languages.

var teams = new Array();
   teams["BOS"] = "Boston Red Sox";
   teams["NYY"] = "New York Yankees";
   teams["ARI"] = "Arizona Diamondbacks";
   teams["ATL"] = "Atlanta Braves";
   teams["BAL"] = "Baltimore Orioles";
   teams["CHC"] = "Chicago Cubs";
   teams["CHW"] = "Chicago White Sox";
   teams["CIN"] = "Cincinnati Reds";
   teams["CLE"] = "Cleveland Indians";
   teams["COL"] = "Colorado Rockies";
   teams["DET"] = "Detroit Tigers";
   teams["FLA"] = "Florida Marlins";
   teams["HOU"] = "Houston Astros";
   teams["KCR"] = "Kansas City Royals";
   teams["LAA"] = "Los Angeles Angels";
   teams["LAD"] = "Los Angeles Dodgers";
   teams["MIL"] = "Milwaukee Brewers";
   teams["MIN"] = "Minnesota Twins";
   teams["NYM"] = "New York Mets";
   teams["OAK"] = "Oakland Athletics";
   teams["PHI"] = "Philadelphia Phillies";
   teams["PIT"] = "Pittsburgh Pirates";
   teams["SDP"] = "San Diego Padres";
   teams["SFG"] = "San Francisco Giants";
   teams["SEA"] = "Seattle Mariners";
   teams["STL"] = "St. Louis Cardinals";
   teams["TBR"] = "Tampa Bay Rays";
   teams["TEX"] = "Texas Rangers";
   teams["TOR"] = "Toronto Blue Jays";
   teams["WSN"] = "Washington Nationals";

function getName(code) {
       return teams[code];
}

var teamShort = new Array();
   teamShort["BOS"] = "Red Sox";
   teamShort["NYY"] = "Yankees";
   teamShort["ARI"] = "Diamondbacks";
   teamShort["ATL"] = "Braves";
   teamShort["BAL"] = "Orioles";
   teamShort["CHC"] = "Cubs";
   teamShort["CHW"] = "White Sox";
   teamShort["CIN"] = "Reds";
   teamShort["CLE"] = "Indians";
   teamShort["COL"] = "Rockies";
   teamShort["DET"] = "Tigers";
   teamShort["FLA"] = "Marlins";
   teamShort["HOU"] = "Astros";
   teamShort["KCR"] = "Royals";
   teamShort["LAA"] = "Angels";
   teamShort["LAD"] = "Dodgers";
   teamShort["MIL"] = "Brewers";
   teamShort["MIN"] = "Twins";
   teamShort["NYM"] = "Mets";
   teamShort["OAK"] = "Athletics";
   teamShort["PHI"] = "Phillies";
   teamShort["PIT"] = "Pirates";
   teamShort["SDP"] = "Padres";
   teamShort["SFG"] = "Giants";
   teamShort["SEA"] = "Mariners";
   teamShort["STL"] = "Cardinals";
   teamShort["TBR"] = "Rays";
   teamShort["TEX"] = "Rangers";
   teamShort["TOR"] = "Blue Jays";
   teamShort["WSN"] = "Nationals";

function getShortName(code) {
       return teamShort[code];
}
 //  getName("NYY"); will return New York Yankees,
 // and getShortName("NYY") will return Yankees

Related posts:

  1. Hypothetical Spring Training Trip Schedule
  2. Fantasy BB Draft
  3. Manny Ramirez Waived!
  4. Webhosting problem
  5. Thoughts on MLB Japan All Star Games
This entry was posted in Web/Print Design and Dev. Bookmark the permalink. Trackbacks are closed, but you can post a comment.

2 Comments

  1. egrdbr
    Posted Tuesday, February 21, 2012 at 02/21/2012 @ 7:46 pm | Permalink

    Some abbreviations are wrong.

    P.S They don’t have to have three letters, they can have two. Royals are KC not KCR

  2. Posted Saturday, March 10, 2012 at 03/10/2012 @ 5:12 pm | Permalink

    Thanks. But this is what I use.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Welcome to Daigo’s Daily Digital Diorama. I blog about... whatever that comes to my mind.
  • Change color

    Purple Red Green Blue No Style

  • Archives

  • Calendar

    October 2009
    M T W T F S S
    « Sep   Dec »
     1234
    567891011
    12131415161718
    19202122232425
    262728293031  
  • Categories