Class StringExtensions
Extension methods for strings.
Assembly: Dalamud.dll
View Source
public static class StringExtensions
Methods
Format(string, params object[])
An extension method to chain usage of string.Format.
View Source
public static string Format(this string format, params object[] args)
Returns
System.String
: Formatted string.
Parameters
Type | Name | Description |
---|---|---|
System.String | format | Format string. |
System.Object[] | args | Format arguments. |
IsNullOrEmpty(string?)
Indicates whether the specified string is null or an empty string ("").
View Source
public static bool IsNullOrEmpty(this string? value)
Returns
System.Boolean
: true if the value parameter is null or an empty string (""); otherwise, false.
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to test. |
IsNullOrWhitespace(string?)
Indicates whether a specified string is null, empty, or consists only of white-space characters.
View Source
public static bool IsNullOrWhitespace(this string? value)
Returns
System.Boolean
: true if the value parameter is null or an empty string (""), or if value consists exclusively of white-space characters.
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to test. |
IsValidCharacterName(string, bool)
Validate if character name is valid using game check.
View Source
public static bool IsValidCharacterName(this string value, bool includeLegacy = true)
Returns
System.Boolean
: indicator if character is name is valid.
Parameters
Type | Name | Description |
---|---|---|
System.String | value | character name to validate. |
System.Boolean | includeLegacy | include legacy names (combined can be 30 instead of 20). |
FirstCharToUpper(string?, CultureInfo?)
Converts the first character of the string to uppercase while leaving the rest of the string unchanged.
View Source
public static string? FirstCharToUpper(this string? input, CultureInfo? culture = null)
Returns
System.String
: A new string with the first character converted to uppercase.
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The input string. |
System.Globalization.CultureInfo | culture |
FirstCharToLower(string?, CultureInfo?)
Converts the first character of the string to lowercase while leaving the rest of the string unchanged.
View Source
public static string? FirstCharToLower(this string? input, CultureInfo? culture = null)
Returns
System.String
: A new string with the first character converted to lowercase.
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The input string. |
System.Globalization.CultureInfo | culture |
StripSoftHyphen(string)
Removes soft hyphen characters (U+00AD) from the input string.
View Source
public static string StripSoftHyphen(this string input)
Returns
System.String
: A string with all soft hyphens removed.
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The input string to remove soft hyphen characters from. |
Truncate(string, int, string)
Truncates the given string to the specified maximum number of characters,
appending an ellipsis if truncation occurs.
View Source
public static string? Truncate(this string input, int maxChars, string ellipses = "...")
Returns
System.String
: The truncated string, or the original string if no truncation is needed.
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The string to truncate. |
System.Int32 | maxChars | The maximum allowed length of the string. |
System.String | ellipses | The string to append if truncation occurs (defaults to "..."). |