Skip to content

StringHelper class

namespace: Serenity   assemblySerenity.Net.Core

This static class contains some helper functions that operate on String objects.

public static class StringHelper

Public Members

name description
static IsEmptyOrNull(…) Returns true if String is null or empty (zero length) (2 methods)
static IsNullOrEmpty(…) Returns true if String is null or empty (zero length)
static IsTrimmedEmpty(…) Checks if a string String is null, empty or just contains whitespace characters.
static IsTrimmedSame(…) Compares two strings ignoring whitespace at the left or right.
static Join(…) Joins two strings conditionally, by putting separator between if both are non empty
static QuoteString(…) Quotes a string
static RemoveDiacritics(…) Removes the diacritic characters from string by replacing them with ASCII versions.
static SafeSubstring(…) A substring function that doesn't raise out of bound errors or null reference exception.
static SanitizeFilename(…) Sanitizes the filename by replacing /, :, &, ı characters.
static ThreeDots(…) If the string's length is over a specified limit, trims its right and adds three points ("...").
static ToSingleLine(…) Converts the string to single line by replacing line endings with space.
static ToSingleQuoted(…) Converts the string to its single quoted representation.
static ToStringDefault<T>(…) Formats a nullable struct (2 methods)
static TrimToEmpty(…) Removes whitespace characters in the left or right of the String string, and if resulting string is empty or null, returns empty.
static TrimToNull(…) Removes whitespace characters in the left or right of the String string, and if resulting string is empty or null, returns null.

See Also