Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 6f5226c9 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

StringExtensionMethods: reformated IndulgentParse, ToStream, and RemoveWhitespace

parent 85827244
No related branches found
No related tags found
No related merge requests found
......@@ -84,20 +84,14 @@ namespace TUGraz.VectoCommon.Utils
return int.Parse(self) != 0;
}
public static double IndulgentParse(this string self)
{
return double.Parse(new string(self.Trim().TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()),
public static double IndulgentParse(this string self) =>
double.Parse(new string(self.Trim().TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()),
CultureInfo.InvariantCulture);
}
public static Stream ToStream(this string self)
{
return new MemoryStream(Encoding.UTF8.GetBytes(self));
}
public static Stream ToStream(this string self) =>
new MemoryStream(Encoding.UTF8.GetBytes(self));
public static string RemoveWhitespace(this string self)
{
return string.Concat(self.Split());
}
public static string RemoveWhitespace(this string self) =>
string.Concat(self.Split());
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment