Assembly: OptimaJet.Workflow.Core

Class HelperParser

OptimaJet.Workflow.Core.Helpers.HelperParser

Provides utilities for parsing delimiter-separated text, matching wildcard masks, and formatting camel-cased text.

public static class HelperParser

Methods

public static List<string> SplitWithTrim(string text, string[] delimiter) #
Splits text using any of the specified delimiters and trims leading and trailing whitespace from each segment that was not initially empty.

Parameters

Name
Type
Description
text
String
The text to split.
delimiter
String[]
The delimiters that separate segments in text.

Returns

Type
Description
List<String>
The trimmed segments. An empty list is returned when text is null.
public static List<string> SplitWithTrim(string text, string delimiter) #
Splits text using the specified delimiter and trims leading and trailing whitespace from each segment that was not initially empty.

Parameters

Name
Type
Description
text
String
The text to split.
delimiter
String
The delimiter that separates segments in text.

Returns

Type
Description
List<String>
The trimmed segments. An empty list is returned when text is null.
public static List<(string, string)> Parse2xNList(string text, string[] outerDelimiters, string[] innerDelimiters) #
Parses text into pairs by splitting it into outer segments and selecting the first and last values obtained by splitting each segment.

Parameters

Name
Type
Description
text
String
The text containing the pairs to parse.
outerDelimiters
String[]
The delimiters that separate pairs.
innerDelimiters
String[]
The delimiters that separate values within each pair.

Returns

Type
Description
List<String, String>
The parsed pairs in input order. An empty list is returned when text is null.

Exceptions

Type
Description
InvalidOperationException
Thrown when an outer segment does not contain a value after it is split using innerDelimiters.
public static List<(string, string)> Parse2xNList(string text, string outerDelimiter, string innerDelimiter) #
Parses text into pairs by splitting it into outer segments and selecting the first and last values obtained by splitting each segment.

Parameters

Name
Type
Description
text
String
The text containing the pairs to parse.
outerDelimiter
String
The delimiter that separates pairs.
innerDelimiter
String
The delimiter that separates values within each pair.

Returns

Type
Description
List<String, String>
The parsed pairs in input order. An empty list is returned when text is null.

Exceptions

Type
Description
InvalidOperationException
Thrown when an outer segment does not contain a value after it is split using innerDelimiter.
public static List<(List<string>, List<string>)> Parse2xNxNList(string text, string outerDelimiter, string innerDelimiter, string leftDelimiter, string rightDelimiter) #
Parses text into pairs of value groups. For each outer segment, the first and last portions obtained with innerDelimiter are split independently.

Parameters

Name
Type
Description
text
String
The text containing the value groups to parse.
outerDelimiter
String
The delimiter that separates pairs of value groups.
innerDelimiter
String
The delimiter that separates the left and right portions of each pair.
leftDelimiter
String
The delimiter that separates values in the left portion of each pair.
rightDelimiter
String
The delimiter that separates values in the right portion of each pair.

Returns

Type
Description
List<String, String>
The parsed pairs in input order, with the left values first and the right values second. An empty list is returned when text is null.

Exceptions

Type
Description
InvalidOperationException
Thrown when an outer segment does not contain a portion after it is split using innerDelimiter.
public static string Join(string separator, IEnumerable<string> values) #
Joins a sequence of values, placing separator between consecutive values.

Parameters

Name
Type
Description
separator
String
The text to place between consecutive values.
values
IEnumerable<String>
The values to join.

Returns

Type
Description
String
The joined text, or string.Empty when values is null or contains no elements.
public static bool CheckMask(string Source, string maskFiles) #
Determines whether Source matches maskFiles using case-sensitive wildcard matching.

Parameters

Name
Type
Description
Source
String
The text to match.
maskFiles
String
The wildcard mask, where an asterisk matches zero or more characters and a question mark matches exactly one character.

Returns

Type
Description
Boolean
true if the entire text matches the mask; otherwise, false.
public static List<string> SplitCamelCasing(string source) #
Splits camel-cased text into component segments by recognizing Unicode letter casing.

Parameters

Name
Type
Description
source
String
The camel-cased text to split.

Returns

Type
Description
List<String>
The nonempty segments in their original order and casing.

Exceptions

Type
Description
ArgumentNullException
Thrown when source is null.
public static string CamelCasingToPhrase(string source, bool firstBig = true) #
Converts the segments returned by HelperParser.SplitCamelCasing(string) into a space-separated phrase.

Parameters

Name
Type
Description
source
String
The camel-cased text to convert.
firstBig
Boolean
true to title-case segments that match the first segment and lowercase all other segments; false to lowercase all segments.

Returns

Type
Description
String
The space-separated phrase.

Exceptions

Type
Description
ArgumentNullException
Thrown when source is null.