Skip to main content

Class TextUtil

Provides utility methods for text processing and string manipulation operations in the Xperiflow system.

Namespace: Workspace.XBR.Xperiflow.Utilities.Text

Assembly: Xperiflow.dll

Declaration
public static class TextUtil

Examples

Processing multi-select strings:

// Parse comma-delimited string to list
var ids = TextUtil.SplitMSDelimitedStringToGuids(si, "123e4567-e89b-12d3-a456-426614174000,987fcdeb-51a2-43d1-9f4e-123456789abc", "(None)");

// Concatenate collection with delimiter
var result = TextUtil.ConcatWithDelimiter(si, new[] { "apple", "banana", "cherry" }, ", ");
// Result: "apple, banana, cherry"

// Concatenate with prefix/suffix
var sqlList = TextUtil.ConcatWithDelimiterAndPrefixSuffix(si, new[] { "item1", "item2" }, ",", "'", "'");
// Result: "'item1','item2'"

Remarks

The Workspace.XBR.Xperiflow.Utilities.Text.TextUtil class contains static methods for common text processing operations including string parsing, concatenation, and formatting. These utilities are designed to handle common scenarios in data processing workflows where text manipulation is required.

Key Features:

  • Multi-Select String ProcessingParse delimited strings into strongly-typed collections (string, GUID, int)

  • String ConcatenationJoin collections into delimited strings with optional prefix/suffix formatting

  • Text FormattingFormat text for display including line wrapping capabilities

  • Empty Sentinel SupportHandle special empty sentinel values in multi-select scenarios

Usage Guidelines:

All methods require a valid OneStream.Shared.Common.SessionInfo parameter for error handling and logging. Methods that process delimited strings expect comma-separated values and handle both "value1,value2" and "value1, value2" formats automatically.

Methods

SplitMSDelimitedString(SessionInfo, string, string)

Splits a multi-select delimited list parameter into a list of strings. If the 'emptySentinel' is found in the delimited list, then an empty list will be returned.

Declaration
public static List<string> SplitMSDelimitedString(SessionInfo si, string inputString, string emptySentinel)
Returns

System.Collections.Generic.List<System.String>

A list of strings, split from the input string using the delimiter ",". If the 'emptySentinel' is found in the input string, an empty list will be returned.

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.StringinputStringThe input string to be split into a list.
System.StringemptySentinelA string that, if found in the input string, will result in an empty list being returned.

SplitMSDelimitedStringToGuids(SessionInfo, string, string)

Splits a multi-select delimited list parameter into a list of GUIDs. If the 'emptySentinel' is found in the delimited list, then an empty list will be returned.

Declaration
public static List<Guid> SplitMSDelimitedStringToGuids(SessionInfo si, string inputString, string emptySentinel)
Returns

System.Collections.Generic.List<System.Guid>

A list of GUIDs, split from the input string using the delimiter ",". If the 'emptySentinel' is found in the input string, an empty list will be returned.

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.StringinputStringThe input string to be split into a list of GUIDs.
System.StringemptySentinelA string that, if found in the input string, will result in an empty list being returned.

SplitMSDelimitedStringToInts(SessionInfo, string, string)

Splits a multi-select delimited list parameter into a list of Ints. If the 'emptySentinel' is found in the delimited list, then an empty list will be returned.

Declaration
public static List<int> SplitMSDelimitedStringToInts(SessionInfo si, string inputString, string emptySentinel)
Returns

System.Collections.Generic.List<System.Int32>

A list of Ints, split from the input string using the delimiter ",". If the 'emptySentinel' is found in the input string, an empty list will be returned.

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.StringinputStringThe input string to be split into a list of Ints.
System.StringemptySentinelA string that, if found in the input string, will result in an empty list being returned.

ConcatWithDelimiter(SessionInfo, IEnumerable<object>, string)

Concatenates a list of objects into a single string, separated by a delimiter.

Declaration
public static string ConcatWithDelimiter(SessionInfo si, IEnumerable<object> elements, string delimiter)
Returns

System.String

A string containing all the elements in the input list, separated by the given delimiter.

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.Collections.Generic.IEnumerable<System.Object>elementsThe list of objects to be concatenated into a single string.
System.StringdelimiterThe delimiter to be used to separate the elements in the resulting string.

ConcatWithDelimiter(SessionInfo, IEnumerable<string>, string)

Concatenates a list of strings into a single string, separated by a delimiter.

Declaration
public static string ConcatWithDelimiter(SessionInfo si, IEnumerable<string> elements, string delimiter)
Returns

System.String

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.Collections.Generic.IEnumerable<System.String>elementsThe list of strings to be concatenated into a single string.
System.StringdelimiterThe delimiter to be used to separate the elements in the resulting string.

ConcatWithDelimiterAndPrefixSuffix(SessionInfo, IEnumerable<object>, string, string, string)

Concatenates a list of objects into a single string, separated by a delimiter and with a prefix and suffix added to each element.

Declaration
public static string ConcatWithDelimiterAndPrefixSuffix(SessionInfo si, IEnumerable<object> elements, string delimiter, string prefix, string suffix)
Returns

System.String

A string containing all the elements in the input list, separated by the given delimiter and with the given prefix and suffix added to each element.

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session info object for the current session.
System.Collections.Generic.IEnumerable<System.Object>elementsThe list of objects to be concatenated into a single string.
System.StringdelimiterThe delimiter to be used to separate the elements in the resulting string.
System.StringprefixThe prefix to be added to each element in the resulting string.
System.StringsuffixThe suffix to be added to each element in the resulting string.

WrapText(string, int)

Wraps the provided text so that each line does not exceed the specified maximum character length.

Declaration
public static string WrapText(string text, int maxCharsPerLine)
Returns

System.String

A string where the text is split into lines, with each line not exceeding the specified character limit. Lines are separated by newline characters. If a single word is longer than the specified limit, it will be split across multiple lines.

Parameters
TypeNameDescription
System.StringtextThe text to be wrapped.
System.Int32maxCharsPerLineThe maximum number of characters allowed per line.
Exceptions

System.ArgumentException Thrown when maxCharsPerLine is less than or equal to 0.

Inherited Members

  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object,System.Object)
  • System.Object.GetHashCode
  • System.Object.GetType
  • System.Object.MemberwiseClone
  • System.Object.ReferenceEquals(System.Object,System.Object)
  • System.Object.ToString

Was this page helpful?