mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Added function to convert space-terminated (' ', 0x20, ASCII)
ASCII byte arrays to string.
This commit is contained in:
@@ -71,6 +71,25 @@ namespace DiscImageChef
|
|||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string SpaceTerminatedToString(byte[] SpaceTerminatedString)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
|
||||||
|
for (int i = SpaceTerminatedString.Length; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
if (SpaceTerminatedString[i - 1] != 0x20)
|
||||||
|
{
|
||||||
|
length = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Encoding.ASCII.GetString(SpaceTerminatedString, 0, length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user