Hi team, I have integer value.
Sometimes the int value have minus sign.
If integer value contains minus sign need to remove minus sign from the integer value.
Input : -23
Output: 23
Hi team, I have integer value.
Sometimes the int value have minus sign.
If integer value contains minus sign need to remove minus sign from the integer value.
Input : -23
Output: 23
Hi @Baby123
IntVariable = -23
If
IntVariable.ToString.Contains("-")
Then
IntVariable = Cint(IntVariable.ToSTring.Replace("-",""))
End If
Or else you can simply use:
Math.Abs(IntValue)
Regards
You can just use Math.abs(integervariable)
this always gives the positive value only
cheers
Hi @Baby123
You can try these
If the input is string value just use any of the below methods
System.Text.RegularExpressions.Regex.Match(Input,"\d+").ToString
Input.Replace("-")
if the Input is integer datatype try this
Math.Abs(Input)
Regards
Sudharsan
Hi @Baby123
- Assign -> Input = -23
- Assign -> Input = If(Input.toString.contains("-"),CInt(Input.toString.replace("-","")),Input)
Hope it helps!!
assign your interger variable = Math.Abs(yourIntegerValue)
→ Can use Math.Abs to get the absolute vlue of integer by removing -ve sign.
->Can use regex ,bu converting integer to string , remove any occurrence of the minus sign.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.