Class
- Namespace
- CoreFramework
Provides extension methods for string manipulation and formatting.
public static class StringExtensions
- Inheritance
-
object
Methods
ConvertToAlphanumeric(string, bool)
Converts the input string to an alphanumeric string, optionally allowing periods.
public static string ConvertToAlphanumeric(this string input, bool allowPeriods = false)
Parameters
input
stringThe input string to be converted.
allowPeriods
boolA boolean flag indicating whether periods should be allowed in the output string.
Returns
- string
A new string containing only alphanumeric characters, underscores, and optionally periods. If the input string is null or empty, an empty string is returned.
IsBlank(string)
Checks if a string contains null, empty, or white space.
public static bool IsBlank(this string val)
Parameters
val
string
Returns
- bool
IsNullOrEmpty(string)
Checks if a string is Null or empty
public static bool IsNullOrEmpty(this string value)
Parameters
value
string
Returns
- bool
IsNullOrWhiteSpace(string)
Checks if a string is Null or white space
public static bool IsNullOrWhiteSpace(this string val)
Parameters
val
string
Returns
- bool
OrEmpty(string)
Checks if a string is null and returns an empty string if it is.
public static string OrEmpty(this string val)
Parameters
val
string
Returns
- string
RichAlign(string, string)
public static string RichAlign(this string text, string align)
Parameters
text
stringalign
string
Returns
- string
RichBold(string)
public static string RichBold(this string text)
Parameters
text
string
Returns
- string
RichColor(string, string)
public static string RichColor(this string text, string color)
Parameters
text
stringcolor
string
Returns
- string
RichFont(string, string)
public static string RichFont(this string text, string font)
Parameters
text
stringfont
string
Returns
- string
RichGradient(string, string, string)
public static string RichGradient(this string text, string color1, string color2)
Parameters
text
stringcolor1
stringcolor2
string
Returns
- string
RichItalic(string)
public static string RichItalic(this string text)
Parameters
text
string
Returns
- string
RichRotation(string, float)
public static string RichRotation(this string text, float angle)
Parameters
text
stringangle
float
Returns
- string
RichSize(string, int)
public static string RichSize(this string text, int size)
Parameters
text
stringsize
int
Returns
- string
RichSpace(string, float)
public static string RichSpace(this string text, float space)
Parameters
text
stringspace
float
Returns
- string
RichStrikethrough(string)
public static string RichStrikethrough(this string text)
Parameters
text
string
Returns
- string
RichUnderline(string)
public static string RichUnderline(this string text)
Parameters
text
string
Returns
- string
Shorten(string, int)
Shortens a string to the specified maximum length. If the string's length is less than the maxLength, the original string is returned.
public static string Shorten(this string val, int maxLength)
Parameters
val
stringmaxLength
int
Returns
- string
Slice(string, int, int)
Slices a string from the start index to the end index.
public static string Slice(this string val, int startIndex, int endIndex)
Parameters
val
stringstartIndex
intendIndex
int
Returns
- string