Hello.
I’m practicing creation of custom activities in UiPath. In this example, I want to write an activity which extracts numbers and spaces only from a given string. I wrote a code in Visual Studio, built it, loaded the .dll file to the NuGet and then added to UiPath. But as the output it gives no result unfortunately. What am I doing wrong?
Here’s the Main.xaml
Main.xaml (7.5 KB)
Here’s the Activity .nupkg
extractNumbersActivities.1.0.1.nupkg (3.9 KB)
Here’s the Visual Studio code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using System.ComponentModel;
namespace extractNumbersActivity
{
public class extractNumbers : CodeActivity
{
[Category("Input")]
public InArgument<string> inputString { get; set; }
[Category("Output")]
public InArgument<string> outputString { get; set; }
protected override void Execute(CodeActivityContext context)
{
string _inputString = inputString.Get(context);
string _outputString = "";
for(int i = 0; i < _inputString.Length; i++)
{
if (_inputString[i] >= '0' && _inputString[i] <= '9')
_outputString += _inputString[i];
else
_outputString += ' ';
}
outputString.Set(context, _outputString);
}
}
}