-
Notifications
You must be signed in to change notification settings - Fork 0
/
Convert.cs
51 lines (44 loc) · 1.24 KB
/
Convert.cs
1
2
3
4
5
6
7
8
9
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
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Text.RegularExpressions;
namespace capp1
{
public sealed class Convert
{
private static Convert instance = null;
private static readonly object Instancelock = new object();
private Convert() { }
public static Convert GetInstance
{
get
{
if (instance == null)
{
lock (Instancelock)
{
if (instance == null)
{
instance = new Convert();
}
}
}
return instance;
}
}
public int ToInt(Group group)
{
return int.Parse(group.Value);
}
public float ToFloat(Group group)
{
return float.Parse(group.Value);
}
public string ToString(Group group)
{
return group.Value.Trim();
}
public DateTime ToDateTime(Group group)
{
return DateTime.ParseExact(group.Value, "dd.mm.yyyy", System.Globalization.CultureInfo.InvariantCulture);
}
}
}