funcmoneyValue(valuestring)float64{// check if negative is in the incoming string, in cases of -$12.23isNegative:=strings.Contains(value,"-")val,err:=strconv.ParseFloat(value,64)forerr!=nil&&len(value)>0{value=value[1:]val,err=strconv.ParseFloat(value,64)}// catch for leading '-' placements, in cases of -$12.23ifisNegative&&val>0{val=-val}returnval}
In Go!
Go Playground