Im doing a split string on MRC-18300/12/000008 with the separator “/” ( split(0), split(1), split(2), )
Then im writing the result on a excel , my problem is split(2) on excel the zero are not taken into account, it’s writing 8 and I want 000008.
And if it’s MRC-18300/12/000099 i want on the excel 000099 not 99
Your problems is not Split function but Excel.
Excel interpret 000008 as number therefore removes any leading zero.
You should add ’ (single quote) in front to force Excel to interpret is as text
Then fine we can directly mention this
.str_output = Split(str_input.ToString,”/“).Last().ToString.Trim
And still if that doesn’t work while typing did we try that manually whether it is accepting of typed
Or try with copy paste method
That is pass the variable str_output to SET TO CLIPBOARD activity
Then use SEND HOT KEY activity with key as ctrl+v
Which will paste the value from clipboard to that field
Fine
If we are passing this value to any web page or any application then use this str_output = Split(str_input.ToString,”/“).Last().ToString.Trim
Or
If we are trying to update this In a excel file we need to concatenate a single quote before like this str_output = “‘“ + Split(str_input.ToString,”/“).Last().ToString.Trim
Fine let’s do one thing
If you can set that column as text in excel itself so that it will become as a template
And whenever data is added to that column it will have zero in it
And also we won’t.m face issue while passing that to web page
So use this alone as expression
str_output = Split(str_input.ToString,”/“).Last().ToString.Trim
But ensure that the column in excel is set to Text type this (making that as a template accepting zero in front)