I have a value like E34562314/2 and I want to separate the value like 1st part E34562314 and second part is 2. But the problem is that 1st part length is not fixed and sometimes it may contain space after the number before the /. Sometimes there is only first part /and second part is absent. How to deal with such a scenario?
Hi @Omkar_Shete1 ,
Check the below Expression :
Split("E34562314/2","/")(0) //First Part
Split("E34562314/2","/")(1) //Second Part
Maybe to handle this part, we can first check if there are 2 parts available, then only extract the Second Part. We can do so using the below expression in an Assign
Activity.
SecondPartVar = if(Split("E34562314/2","/").Count>1,Split("E34562314/2","/")(1),Nothing)
Here Nothing
is assigned to the SecondPartVar
variable if there is only FirstPart available. Moving further, we can check if this variable is Nothing, and then do the operations accordingly.
Thanks for the solution. But how to check whether / is present ? If / is present then only i want to split else not.
Thanks. I will try itβ¦
Hi @Omkar_Shete1
If you donβt know what character comes then use regex.
Use Assign Activity.
On left side put Array variable
On Right side put β System.Text.RegularExpressions.Regex.Split(var_InitText,β\Wβ).ToList
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.