Substring
- 08 Dec 2022
- 1 Minute to read
- Print
- DarkLight
Substring
- Updated on 08 Dec 2022
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Step Details | |
Introduced in Version | 4.0.0 |
Last Modified in Version | 7.12.0 |
Location | Data > Text |
The Substring step extracts characters, between two positions, from a string and returns the substring.
Properties
Inputs
Property | Description | Data Type |
---|---|---|
Input | The string to break into a substring. | String |
Length | The desired length of the substring. If this number exceeds the input length, the step will not break the input into a substring regardless of the start index. If this number paired with the defined start index is longer than the length of the input, the step will cause an error. | Int32 |
Start Index | The index in which to start the substring. Starting index is 0. This number can not be larger than the length of the substring, or the step will cause an error. | Int32 |
Outputs
Property | Description | Data Type |
---|---|---|
Substring1_Output | The part of the string that was extracted. | String |
Example Inputs and Outputs
Input | Length | Start Index | Output |
---|---|---|---|
Hello World | 5 | 0 | Hello |
Hello World | 5 | 6 | World |
Hello World | 12 | 2 | Hello World |
Hello World | 6 | 6 | EXCEPTION MESSAGE |
Hello World | 2 | 12 | EXCEPTION MESSAGE |
Null Value | 6 | 6 | No Output Present |
Empty String | 6 | 6 | Empty String |
Common Errors
Index and length must refer to a location within the string
If the Length paired with the defined Start Index is longer than the length of the Input, the step will cause an error.
To correct this, change the length or the starting index not to exceed the input's length.
Exception Message:
Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Substring 1[Substring] in flow [Display Steps]: Exception invoking method Substring on class StringSteps
---> DecisionsFramework.LoggedException: Exception invoking method Substring on class StringSteps
---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
at System.String.Substring(Int32 startIndex, Int32 length)
--- End of inner exception stack trace ---
at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data
at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData)
at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData)
--- End of inner exception stack trace ---
StartIndex cannot be larger than length of string
If the Start Index number is larger than the Length of the substring, the step will cause an error.
To correct this, change the Start Index not to exceed the Length.
Exception Message:
Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Substring 1[Substring] in flow [Display Steps]: Exception invoking method Substring on class StringSteps
---> DecisionsFramework.LoggedException: Exception invoking method Substring on class StringSteps
---> System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex'
at System.String.Substring(Int32 startIndex, Int32 length)
--- End of inner exception stack trace --- at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data
at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData
at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData)
--- End of inner exception stack trace ---
Was this article helpful?