Search Results for

    Show / Hide Table of Contents

    Class StringExtraction

    Contains methods to extract data from strings

    Inheritance
    System.Object
    StringExtraction
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Simplic.Text
    Assembly: Simplic.CoreLib.dll
    Syntax
    public static class StringExtraction

    Methods

    | Improve this Doc View Source

    CastAsNumber(String, IList<Char>, Int32, Int32)

    Extract a number from string and remove thousand-separator

    Declaration
    public static double CastAsNumber(string input, IList<char> separators, int minDecimalNumbers = 2, int maxAlphanumericChars = 2)
    Parameters
    Type Name Description
    System.String input

    Input string

    System.Collections.Generic.IList<System.Char> separators
    System.Int32 minDecimalNumbers

    Minimum decimal numbers

    System.Int32 maxAlphanumericChars
    Returns
    Type Description
    System.Double

    Extracted double or null. Throws an exception if casting failed

    | Improve this Doc View Source

    CastAsNumber(String, Int32, Int32)

    Extract a number from string and remove thousand-separator

    Declaration
    public static double CastAsNumber(string input, int minDecimalNumbers = 2, int maxAlphanumericChars = 2)
    Parameters
    Type Name Description
    System.String input

    Input string

    System.Int32 minDecimalNumbers

    Minimum decimal numbers

    System.Int32 maxAlphanumericChars
    Returns
    Type Description
    System.Double

    Extracted double or null. Throws an exception if casting failed

    | Improve this Doc View Source

    ExtractDateTime(String)

    Searches from date values in a string

    Declaration
    public static DateTime? ExtractDateTime(string input)
    Parameters
    Type Name Description
    System.String input

    Input string that will be used for searching

    Returns
    Type Description
    System.Nullable<System.DateTime>

    Returns a System.DateTime instance of the text contains a date time in the format (dd.MM.yyyy HH:mm) HH:mm is optional

    | Improve this Doc View Source

    FindInLine(String, IList<ExtractionKey>, IList<ExtractionValue>, Func<String, Boolean>, String, Boolean, Int32)

    Find value within text block

    Declaration
    public static ExtractionResult FindInLine(string textBlock, IList<ExtractionKey> keys, IList<ExtractionValue> valueWhiteList, Func<string, bool> validateValue = null, string charsToRemove = ".:;", bool forceWhiteList = false, int minResultLenght = 3)
    Parameters
    Type Name Description
    System.String textBlock

    Text block as string

    System.Collections.Generic.IList<ExtractionKey> keys

    List of keys to search for

    System.Collections.Generic.IList<ExtractionValue> valueWhiteList

    List of allowed values

    System.Func<System.String, System.Boolean> validateValue
    System.String charsToRemove

    Chars to remove from a key while comparing

    System.Boolean forceWhiteList
    System.Int32 minResultLenght
    Returns
    Type Description
    ExtractionResult

    Result instance, which fits the most

    | Improve this Doc View Source

    FindInLine(String, IList<ExtractionKey>, String, Func<String, Boolean>, String, Int32)

    Find value within text block

    Declaration
    public static ExtractionResult FindInLine(string textBlock, IList<ExtractionKey> keys, string regex, Func<string, bool> validateValue = null, string charsToRemove = ".:;", int minResultLenght = 3)
    Parameters
    Type Name Description
    System.String textBlock

    Text block as string

    System.Collections.Generic.IList<ExtractionKey> keys

    List of keys to search for

    System.String regex

    Regex which matches the value

    System.Func<System.String, System.Boolean> validateValue
    System.String charsToRemove

    Chars to remove from a key while comparing

    System.Int32 minResultLenght
    Returns
    Type Description
    ExtractionResult

    Result instance, which fits the most

    | Improve this Doc View Source

    FindInNextLine(String, IList<ExtractionKey>, IList<ExtractionValue>, Func<String, Boolean>, String, Int32, Boolean)

    Find value within text block and retrieve it from the next line

    Declaration
    public static ExtractionResult FindInNextLine(string textBlock, IList<ExtractionKey> keys, IList<ExtractionValue> valueWhiteList, Func<string, bool> validateValue = null, string charsToRemove = ".:;", int minSplitChars = 3, bool forceWhiteList = false)
    Parameters
    Type Name Description
    System.String textBlock

    Text block as string

    System.Collections.Generic.IList<ExtractionKey> keys

    List of keys to search for

    System.Collections.Generic.IList<ExtractionValue> valueWhiteList

    List of allowed values

    System.Func<System.String, System.Boolean> validateValue
    System.String charsToRemove

    Chars to remove from a key while comparing

    System.Int32 minSplitChars
    System.Boolean forceWhiteList
    Returns
    Type Description
    ExtractionResult

    Result instance, which fits the most

    | Improve this Doc View Source

    FindInNextLine(String, IList<ExtractionKey>, String, Func<String, Boolean>, String, Int32)

    Find value within text block

    Declaration
    public static ExtractionResult FindInNextLine(string textBlock, IList<ExtractionKey> keys, string regex, Func<string, bool> validateValue = null, string charsToRemove = ".:;", int minSplitChars = 3)
    Parameters
    Type Name Description
    System.String textBlock

    Text block as string

    System.Collections.Generic.IList<ExtractionKey> keys

    List of keys to search for

    System.String regex

    Regex which matches the value

    System.Func<System.String, System.Boolean> validateValue
    System.String charsToRemove

    Chars to remove from a key while comparing

    System.Int32 minSplitChars
    Returns
    Type Description
    ExtractionResult

    Result instance, which fits the most

    | Improve this Doc View Source

    SplitLine(String, Char, Int32, Int32, String)

    Split line into a list of strings

    Declaration
    public static IList<string> SplitLine(string line, char splitChar, int minCharBeforeSplit = 1, int minPartLength = 0, string cleanupChars = "1234567890abcdefghijklmnopqrstuvwxyz")
    Parameters
    Type Name Description
    System.String line

    Line to split

    System.Char splitChar

    Split chars

    System.Int32 minCharBeforeSplit

    Minimum chars before splitting

    System.Int32 minPartLength

    Minimum length

    System.String cleanupChars

    Chars to cleanup when length is 0

    Returns
    Type Description
    System.Collections.Generic.IList<System.String>
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2018 SIMPLIC GmbH
    Generated by DocFx