GithubHelp home page GithubHelp logo

rop.string's Introduction

Rop.String

Features

Rop.String includes Helper extension classes to manipulate strings.

Char Helper

Helper class char relative

/// Is Equal with case option
public static bool IsEqualCase(this char a, char b, bool ignoreCase = true);
/// Check if a char is included in a char range with case option
public static bool InRange(this char a, IEnumerable<char> range, bool ignoreCase = false);
/// Check if a char is NOT included in a char range with case option
public static bool NotInRange(this char a, IEnumerable<char> range, bool ignoreCase = false);
/// Create a char range from a char to another
public static IEnumerable<char> RangeChar(char from, char to);
/// Create a char range from a char and count elements
public static IEnumerable<char> RangeChar(char from, int count);
/// Trim blank characters (includes carriage returns)
public static string TrimBlanks(this string s);
/// Trim control characters
public static string TrimControl(this string s);

HexString Helper

Helper class hexadecimal strings relative

/// Unicode string to Hex (WideChar)
public static string ToHexStringW(this string str);
/// Hex to Unicode String (Wide)
public static string FromHexStringW(this string hexString);
/// Ascii String to Hex (Byte char)
public static string ToHexString(this string str);
/// Hex String to Ascii String
public static string FromHexString(this string hexString);

StringBuilder helper

Helper class relative to StringBuilder

/// Append Line with linux end of line
public static StringBuilder AppendUnixLine(this StringBuilder std, string value);
/// Append linux end of line
public static StringBuilder AppendUnixLine(this StringBuilder std);

StringCase helper

Helper class relative to Uppercase and Lowercase and Diacritics

/// Remove Diacritics from text
public static string RemoveDiacritics(this string text);
/// Remove diacritics and Lower string
public static string RemoveDiacriticsAndLower(this string text);
/// String starts with (no case)
public static bool StartsWithNoCase(this string a, string b);
/// String ends with (no case)
public static bool EnsWithNoCase(this string a, string b);
/// Equals no case
public static bool EqualsNoCase(this string a, string b);

StringExtracts helper

Helper class relative to Extract substrings

/// Try extract substring from string
public static bool TryExtract(this string a, string prefix, string suffix,bool trim, StringComparison comparer,out string result);
public static bool TryExtract(this string a, string prefix, string suffix, out string result);
public static bool TryExtract(this string a, string prefix, string suffix, bool trim, out string result);
public static bool TryExtract(this string a, string prefix, string suffix, StringComparison comparer,out string result);
/// Try extract substring from string (no case);
public static bool TryExtractNoCase(this string a, string prefix, string suffix, bool trim, out string result);
public static bool TryExtractNoCase(this string a, string prefix, string suffix, out string result);
/// Try extract substring from strins between two strings
public static string Between(this string cad, string left, string right,bool ignorecase = false);
/// Get left part of a string
public static string LeftTo(this string cad, string sep, bool ignorecase = false);
/// Get right part of a string
public static string RightTo(this string cad, string sep, bool ignorecase = false);
/// Breaks a string in two parts
public static (string, string) Break(this string cad, string separator, bool ignorecase = false);
/// Break a string representing a domain account
public static (string Domain, string User) StripDomain(this string cad);
/// Get user part of a string representing a domain account ensuring domain name
public static string StripDomain(this string cad,string ensuredomain);

String helper

General string helper

/// StartsWith including end index
public static bool StartsWith(this string a,string b, StringComparison comparer, out int endindex);
/// EndsWith including begin index
public static bool EndsWith(this string a, string b, StringComparison comparer, out int beginindex);
/// Check if string starts and ends with a prefix and a suffix and returns index of both
public static bool StartsAndEndsWith(this string a, string b,string c, StringComparison comparer, out int from,out int to);
/// Return a substring or empty if parameters out of index
public static string SafeSubstring(this string cad, int from);
/// Return a substring or empty if parameters out of index
public static string SafeSubstring(this string cad, int from, int length, bool spaces = false);
/// Append all strings in a array
public static string ConcatLines(params string[] cads);
/// Return another string if string is null or empty
public static string IfNullOrEmpty(this string cad, string value);
/// Return another string if string is null or empty or whitespace
public static string IfNullOrWhiteSpace(this string cad, string value);
/// Create a dummy string with maximun value
public static string StringMax { get; } = new string(char.MaxValue, 8);
/// Check if string is digit only
public static bool IsDigitOnly(this string cad);
/// Check if cad represents a integer
public static bool IsInteger(this string cad);
/// Get substring beetween two positions.
public static string Between(this string cad, int left, int right, bool spaces = false);
/// Conver bool value into StringComparison value
public static StringComparison ToIgnoreCase(this bool c);

Token helper

String helper to parsing strings

/// Check if a symbol is present in a position
public static string SymbolInPos(this string cad, int pos, IEnumerable<string> symbols, bool ignorecase = false);
public static string SymbolInPos(this string cad, int pos, params string[] symbols);
/// Extract token from string
public static string GetToken(string[] separator, ref string cad, bool ignorecase = false);
/// Check if a string contains a substring
public static bool ContainsCase(this string cad, string search, bool ignorecase = false);   

(C)2022 Ramón Ordiales Plaza

rop.string's People

Contributors

ramoneeza avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.