mmString Class
OakLeaf.MM.Main.mmString
Extends the functionality of the .NET string base class.AddBackSlash()
- Adds a backslash to the end of the specified path if one does not already exist
public static string AddBackSlash(string path)
Public Shared Function AddBackSlash(String path) as String
Example:
In C#:
string Path = mmString.AddBackSlash(Path);
In VB .NET:
Dim Path as String = mmString.AddBackSlash(Path)
Empty()
- Returns a boolean value indicating if the specified text string is null or empty
public static bool Empty(string stringValue)
Public Shared Function Empty(stringValue As String) As Boolean
Example:
In C#:
if (mmString.Empty(MyString)) { }In VB .NET:
If mmString.Empty(MyString) Then End If
GetText()
- Gets a string suitable for displaying
static public string GetText(object value, String nullText, String format, IFormatProvider formatInfo, TypeConverter typeConverter)
Public Shared Function GetText(value As Object, nullText As [String], format As [String], formatInfo As IFormatProvider, typeConverter As TypeConverter) As String
Example:
In C#:
protected virtual void FormatEventHandler(object sender, ConvertEventArgs cevent) { if (this.Format != null) { cevent.Value = mmString.GetText(cevent.Value,this.NullText,this.Format,this.FormatInfo,this.oTypeConverter); } }In VB .NET:
Protected Overridable Sub FormatEventHandler(ByVal sender As Object, ByVal cEvent As ConvertEventArgs) If Me.Format <> Nothing Then cEvent.Value = mmString.GetText(cEvent.Value, Me.NullText, Me.Format, Me.FormatInfo, Me.oTypeConverter) End If End Sub
InsertSpacesInPascalCasedString
- Inserts spaces into a pascal cased string between upper case characters. Doesn't insert a space if the previous character is also upper case
Example:
In C#:
// Converts "OrderID" to "Order ID" string NewString = mmString.InsertSpacesInPascalCasedString("OrderID");And in VB .NET:
' Converts "OrderID" to "Order ID" NewString As String = mmString.InsertSpacesInPascalCasedString("OrderID")
IsCommentLine()
- Returns a boolean value indicating if the specified text string is a code comment line for the specified language ("CSharp" or "VB")
public static bool IsCommentLine(string text, string language)
Public Shared Function IsCommentLine([text] As String, language As String) As Boolean
Example:
In C#:
if (mmString.IsCommentLine("// Comment", "CSharp")) { }In VB .NET:
If mmString.IsCommentLine("' Comment text", "Basic") Then End If
JustExt()
- Returns just the extension of the file name (without the period)
public static string JustExt(string fileName)
Public Shared Function JustExt(fileName As String) As String
Example:
In C#:
// Returns "xml" string Extension = mmString.JustExt("MyFile.xml");In VB .NET:
' Returns "xml" Dim Extension As String = mmString.JustExt("MyFile.xml")
Occurs()
- Returns an integer specifying the number of times the search character is found in the string searched.
public static int Occurs(char searchCharacter, string stringSearched)
Public Shared Function Occurs(searchCharacter As Char, stringSearched As String) As Integer
- Returns an integer specifying the number of times the search string occurs in the string searched
public static int Occurs(string searchString, string stringSearched) Public Shared Function Occurs(searchString As String, stringSearched As String) As Integer
Example:
In C#:
// Returns 3 int Count = mmString.Occurs("System.Windows.Forms.Form", ".");In VB .NET:
' Returns 3 Dim Count As Int32 = mmString.Occurs("System.Windows.Forms.Form", ".")
Proper()
- Returns the specified string with each word (separated by the specified character) in Proper case
public static string Proper(string text, char separator)
Public Shared Function Proper([text] As String, separator As Char) As String
- Returns the specified string with each word (separated by a space) in Proper case
public static string Proper(string text)
Public Shared Function Proper([text] As String) As String
Example:
In C#:
// Returns "Visual Studio" string ProperText = mmString.Proper("visual studio");In VB .NET:
' Returns "Visual Studio" Dim ProperText As String = mmString.Proper("visual studio")
TrimEnd()
- Trims the specified string from the end of the target string
public static string TrimEnd(string targetString, string trimString)
Public Shared Function TrimEnd(targetString As String, trimString As String) As String
Example:
In C#:
// Returns "Code" string TrimText = mmString.TrimEnd("Code_Test", "_Test");In VB .NET:
' Returns "Code" Dim TrimText As String = mmString.TrimEnd("@Code_Test", "_Test")
TrimStart()
- Trims the specified string from the beginning of the target string
public static string TrimStart(string targetString, string trimString)
Public Shared Function TrimStart(targetString As String, trimString As String) As String
Example:
In C#:
// Returns "CategoryID" string TrimText = mmString.TrimStart("@Original_CategoryID", "@Original_");In VB .NET:
' Returns "CategoryID" Dim TrimText As String = mmString.TrimStart("@Original_CategoryID", "@Original_")
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/27/18
Comment or report problem with topic
