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
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.
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
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.String | inputString | The input string to be split into a list. |
System.String | emptySentinel | A 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.
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
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.String | inputString | The input string to be split into a list of GUIDs. |
System.String | emptySentinel | A 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.
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
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.String | inputString | The input string to be split into a list of Ints. |
System.String | emptySentinel | A 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.
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
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.Collections.Generic.IEnumerable<System.Object> | elements | The list of objects to be concatenated into a single string. |
System.String | delimiter | The 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.
public static string ConcatWithDelimiter(SessionInfo si, IEnumerable<string> elements, string delimiter)
Returns
System.String
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.Collections.Generic.IEnumerable<System.String> | elements | The list of strings to be concatenated into a single string. |
System.String | delimiter | The 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.
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
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session info object for the current session. |
System.Collections.Generic.IEnumerable<System.Object> | elements | The list of objects to be concatenated into a single string. |
System.String | delimiter | The delimiter to be used to separate the elements in the resulting string. |
System.String | prefix | The prefix to be added to each element in the resulting string. |
System.String | suffix | The 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.
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
Type | Name | Description |
---|---|---|
System.String | text | The text to be wrapped. |
System.Int32 | maxCharsPerLine | The 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