Split method gotchas

OK Sorry there’s no handy script in this post but I’ve got to share a gotcha I ran into. When using the Split method on a string Split will split any of the characters it finds in the string not the grouping of the characters. Let me explain by showing a real world example where I learned this.

“Goose_Bay – AST – (GMT/UTC -4)”.Split(“(GMT”)

Because Goose begins with a G it splits this string to “oose_Bay…”. It also did this for all time zones beginning with M and T. So hopefully this will not catch anyone else out there off guard. Now I need to find another method to do this work for me, but I learned something valuable and I wanted to share.


One thought on “Split method gotchas

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s