I started missing the VB-like substring functions absent from C#. They seem to align better with my style of thinking. For example "I need the first 5 characters of a string" or "I need the last 3 characters of a string". Although all this can be done with the ubiquitous "Substring" function in C#, I decided to go ahead and creat my own VB-Style utilities for this.
// A few VB-esque string functions
public static string Left(string MyString, int length)
{
string result = MyString.Substring(0, length);
return result;
}
public static string Right(string MyString, int length)
{
string result = MyString.Substring(MyString.Length - length, length);
return result;
}
public static string Mid(string MyString,int startIndex, int length)
{
string result = MyString.Substring(startIndex, length);
return result;
}
Although this may not appear as a big gain for regular substring work, it does begin to pay off when you get into more complex, nested scripting.