How to split 1 from 0001

how to split 1 from 0001
i’m getting 0001 from excel. i want 1

Hi,

As Int32

CInt("0001")

As String

CInt("0001").ToString

Regards,

Hi

It’s very simple

If you have that value “0001” in a string variable named Strinput then Use like this

Stroutput = strinput.ToString.Replace(“0”,””)

If you want as integer

int_output = Convert.ToInt32(strinput.ToString.Replace(“0”,””)

Cheers @sayed.tabrez

excel value is like
0001
0002
0003
0004
0005
0006
0007

1 Like

There are two working solutions posted already. Try them and you’ll see they work.
They will both truncate your values of 0’s.

My suggestion is to use the cInt([value]).toString one.
The replace one will cause problems if you continue into “0010” since the last 0 will also be replaced.

Hi @sayed.tabrez

Read Range the Excel

For Each row of the readDt

Currentrow(“YouColumnname”).toString.Substring(3)

Will give the result

Regards

Hi

Hope the below steps would help you resolve this

  1. use a excel application scope and pass the file path as input and read the data with read range activity and get the output named dt

  2. Now use a FOR EACH ROW activity and pass dt as input

  3. Inside the loop use a Assign activity like this

CurrentRow(“your columnname”) = CurrentRow(“same columnname”).ToString.TrimStart(“0”c).ToString

Cheers @sayed.tabrez

thank you all every type is working

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.