I am obtaining a number from a cell but sometimes other characters are added as per below:
How would I check each character to confirm it is non-numeric and remove?
OR
How would I check the first character of the string to confirm its non-numeric and remove?
@chend
Just to confirm are you trying to remove β-β this in String. In that case you can use replace activity to replace it to null.
Or you can convert that complete string to double " Convert.ToDouble(yourstring)", so that it will still show as a numeric value.
To check whether string is numeric or not βMicrosoft.VisualBasic.Information.IsNumeric(yourstring.ToString)β
I want to keep the β-β as it is a negative amount.
As the string contains β=β, I am unable to convert to double as it does not recognise as a number format.
I am trying to remove the β=β but the person filling the cell could place any non-numeric characters.
@chend
Use Replace Activity and use below Regex Pattern.
As you said βI am trying to remove the β=β but the person filling the cell could place any non-numeric characters.β. So you have to remove all non numeric characters.
Regex Pattern : [a-z\s_:;'/="]+
If you donβt want to remove alphabets, then use like below
Regex Pattern : [\s_:;'/="]+
So if I assign Cell = ?-123D123
NewCell = System.Text.RegularExpressions.Regex.Replace(Cell,β\Dβ,ββ)
This provides the outocme NewCell = 123123
Is it possible to keep the β-β
So it will result NewCell = -123123
Thank you. It worked perfectly.
I accidentally assigned it outside the activity not knowing it required an output assigned within the replace activity.