Coversion String to integer

A switch case would do the job, then set a case for each number from one to ten. In the case, set a variable to the digit from 0 to 10.

strNumber is a String
intNumber is an Integer
image

1 Like

if you want to check the variable case-insensitive feel free to use variable.ToLower() as your switch case expression

2 Likes

Good call. May also want to add a .Trim in there too if there is any potential for there to be white space.

image

2 Likes

after run not display any digit

The digit is in the variable “intNumber”

If you want to display it on the screen, use a Message Box activity, with the value as intNumber.ToString

what is datatype of intNumber

strNumber is a String
intNumber is an Integer

Good morning Arun,

Does one of the workflows in the following thread fulfill your need?

1 Like

Hi, @chenderson it is the exact opposite of my task… I am trying word to the number Hope someone could help me

@Arun_Pondhe Is the solution I provided not working?

1 Like

@andrewjames did not work thanks for trying help

Add a IF statement
add in the Expression textbox: string_variable.ToLower.Trim = “one”
add to the Then area a assign statement
in this assign statement add numberVariable = 1
after the IF statement add a MessageBox with numberVariable.ToString in the message field.

if the variable string_value is “one” the numberValue will be 1.
copy this if block 9 times and change the values from 2 to 10.

Good luck :slight_smile:

2 Likes

My apologies Arun,

Maybe this solution:

1 Like

@PeterK Yeah I did that and its work but not look good. i was thinking any conversion solution

@chenderson Thank you

1 Like

Yeah :smile: one solution is better than nothing :wink:

Okay, a better solution is the switch case statement mentioned above from @andrewjames
If you could provide us a screenshot of your non-functional switch case function we could help you.

2 Likes

Thank yo so much you all are supporting me

NumToWords.1.0.0.nupkg (4.5 KB)

Try this custom activity.

1 Like

@sureshk328 I want reverse word to a number

NumAndWordsConversion.1.0.0.nupkg (6.0 KB)

Try updated activity. Install it as new activity