- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
/// <summary>
/// Converts to number.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>System.String.</returns>
public static string convertToNumber(string value) {
string mvalue = "0";
string wildchars = @"~!@#$%^&*()_+={}[]|\/?><,`:;'";
bool chknegative = false;
if (value == null)
value = "";
try {
if (value == "") {
mvalue = "0";
}
for (var i = 0; i < wildchars.Length; i++) {
string wildchar = wildchars.Substring(i, 1);
//chknegative = value.Contains(wildchar);
mvalue = value.Replace(wildchar, "");
value = mvalue;
}
chknegative = value.Contains("-");
if (chknegative) {
mvalue = value.Replace("-", "");
mvalue = "-" + mvalue;
}
else {
mvalue = value;
}
}
catch {
mvalue = "0";
}
return mvalue;
}
Elvenfighter 30.12.2014 03:48 # 0
pushistayapodmyshka 30.12.2014 08:22 # 0
hack2root 10.01.2015 09:38 # 0
cyperh 16.01.2015 16:43 # 0