35 lines
840 B
C#
35 lines
840 B
C#
namespace AutoCatCore.Model;
|
||
|
||
public class PlateNumber
|
||
{
|
||
private readonly string _number;
|
||
private readonly string _numberEnglish;
|
||
|
||
private readonly Dictionary<char, char> _lettersMap = new()
|
||
{
|
||
{ 'А', 'A' }, { 'В', 'B' }, { 'Е', 'E' }, { 'К', 'K' },
|
||
{ 'М', 'M' }, { 'Н', 'H' }, { 'О', 'O' }, { 'Р', 'P' },
|
||
{ 'С', 'C' }, { 'Т', 'T' }, { 'У', 'Y' }, { 'Х', 'X' }
|
||
};
|
||
|
||
public PlateNumber(string number)
|
||
{
|
||
this._number = number;
|
||
this._numberEnglish = string.Concat(number.Select(c => _lettersMap.TryGetValue(c, out var eng) ? eng : c));
|
||
}
|
||
|
||
public string AsString()
|
||
{
|
||
return _number;
|
||
}
|
||
|
||
public string MainPart()
|
||
{
|
||
return _numberEnglish[..6];
|
||
}
|
||
|
||
public string Region()
|
||
{
|
||
return _numberEnglish[6..];
|
||
}
|
||
} |