- 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
//checks if the string is a hex stream e.g. "31 32 33 6A F8"
private bool _IsHexStream(string sValue)
{
sValue = sValue.Trim();
if (sValue.Length < 2)
{
return false;
}
for (int i = 0; i < sValue.Length; i++)
{
if(_IsHexChar(Convert.ToChar(sValue.Substring(i,1))) == false)
{
return false;
}
}
//every third char must be a space, only possible in case of two bytes
if (sValue.Length > 3)
{
for (int i = 2; i < sValue.Length; i += 3)
{
string sBuffer = sValue.Substring(i, 1);
if (sBuffer.Equals(" ") == false)
{
return false;
}
}
}
//string is a hex stream
return true;
}
Я все могу понять, но почему он использует sValue.Substring(i,1), вместо sValue[i] я не могу понять
Первое Пение Ведьмы
[0-9a-fA-F]{2}