Last active
January 25, 2024 19:40
-
-
Save mrpmorris/aea3525437f66b8236f07ff1d1f69458 to your computer and use it in GitHub Desktop.
Convert string of floats to floats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static readonly char[] ExtractFloatsTrimChars = new char[] { '[', ']', ' ' }; | |
static float[] ExtractFloats(string input) => | |
input | |
.Trim(ExtractFloatsTrimChars) | |
.Split(',') | |
.Select(float.Parse) | |
.ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment