Skip to content

Char Extensions

Andrzej Kebab edited this page Jan 21, 2024 · 1 revision

UtilityLibrary.Core

This utility library provides extension methods for character operations, allowing you to perform various checks and transformations on characters.

IsControl

IsControl

Checks if a character is categorized as a control character.

using UtilityLibrary.Core;

char character = '\t';
bool isControl = character.IsControl();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a control character; otherwise, false.

IsDigit

IsDigit

Checks if a character is categorized as a decimal digit.

using UtilityLibrary.Core;

char character = '5';
bool isDigit = character.IsDigit();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a digit; otherwise, false.

IsHighSurrogate

IsHighSurrogate

Checks if a character is categorized as a high surrogate.

using UtilityLibrary.Core;

char character = '\uD800';
bool isHighSurrogate = character.IsHighSurrogate();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a high surrogate; otherwise, false.

IsLowSurrogate

IsLowSurrogate

Checks if a character is categorized as a low surrogate.

using UtilityLibrary.Core;

char character = '\uDC00';
bool isLowSurrogate = character.IsLowSurrogate();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a low surrogate; otherwise, false.

IsPunctuation

IsPunctuation

Checks if a character is categorized as a punctuation mark.

using UtilityLibrary.Core;

char character = '.';
bool isPunctuation = character.IsPunctuation();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a punctuation mark; otherwise, false.

IsLetter

IsLetter

Checks if a character is categorized as a letter.

using UtilityLibrary.Core;

char character = 'A';
bool isLetter = character.IsLetter();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a letter; otherwise, false.

IsLetterOrDigit

IsLetterOrDigit

Checks if a character is categorized as a letter or a decimal digit.

using UtilityLibrary.Core;

char character = 'A';
bool isLetterOrDigit = character.IsLetterOrDigit();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a letter or a digit; otherwise, false.

IsSymbol

IsSymbol

Checks if a character is categorized as a symbol.

using UtilityLibrary.Core;

char character = '$';
bool isSymbol = character.IsSymbol();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a symbol; otherwise, false.

IsSeparator

IsSeparator

Checks if a character is categorized as a separator character.

using UtilityLibrary.Core;

char character = ' ';
bool isSeparator = character.IsSeparator();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a separator character; otherwise, false.

IsSurrogate

IsSurrogate

Checks if a character is categorized as either a high or low surrogate.

using UtilityLibrary.Core;

char character = '\uD800';
bool isSurrogate = character.IsSurrogate();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a surrogate; otherwise, false.

IsLower

IsLower

Checks if a character is categorized as a lowercase letter.

using UtilityLibrary.Core;

char character = 'a';
bool isLower = character.IsLower();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is a lowercase letter; otherwise, false.

IsUpper

IsUpper

Checks if a character is categorized as an uppercase letter.

using UtilityLibrary.Core;

char character = 'A';
bool isUpper = character.IsUpper();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is an uppercase letter; otherwise, false.

ToLower

ToLower

Converts a character to its lowercase equivalent.

using UtilityLibrary.Core;

char character = 'A';
char lowercaseCharacter = character.ToLower();

Parameters

  • character (char): The character to convert.

Returns

  • char: The lowercase equivalent of the input character.

ToUpper

ToUpper

Converts a character to its uppercase equivalent.

using UtilityLibrary.Core;

char character = 'a';
char uppercaseCharacter = character.ToUpper();

Parameters

  • character (char): The character to convert.

Returns

  • char: The uppercase equivalent of the input character.

IsWhiteSpace

IsWhiteSpace

Checks if a character is categorized as white space.

using UtilityLibrary.Core;

char character = ' ';
bool isWhiteSpace = character.IsWhiteSpace();

Parameters

  • character (char): The character to check.

Returns

  • bool: true if the character is white space; otherwise, false.

Clone this wiki locally