How to move Negative sign to front of the number

Hello,

I have a negative string number like this “458.10-”
I want to move - negative sign to the front of the number to become like this “-458.10”

One way i found is that. I removed the “-” from string and assign another variable like so

newDouble = cdbl(458.10)*-1

then I will have - sign on the front of the number but I want to know the more effective way to do it.

how do I do that? I tried using regex but it doesn’t work. probably doing it wrong.

Thanks

@phyomt Can you try just Try CDbl(“458.10-”)

1 Like

arh that works as well . didn’t try it before. also any other way to do that in C# function ? not using CDbl

@phyomt This Could be another way but it will be in a String format :
str.Replace("-","").Insert(0,"-")

1 Like

thanks. just want to know the more effective way to do in C# function. Anyways they both work.

1 Like