Try regex:
Regex.Replace(str, @"(?<=\$)\d+(\.\d+)?", "<u>$0</u>");
Some examples of outputs:
"4.5" -> "4.5" (untouched)
"4" -> "4" (untouched)
"$4.5" -> "$<u>4.5</u>"
"$4" -> "$<u>4</u>"
Although, since it is udeprecated, you should probably consider <span>with a class or inline style with a directive text-decoration: underline:
Regex.Replace(str, @"(?<=\$)\d+(\.\d+)?",
"<span style=""text-decoration: underline"">$0</span>");
, : span, , ( "</span>" (3- ) "<span>" )