GlmSharp/GlmSharp5/Quat/quat.cs
/// <summary>
/// Tries to convert the string representation of the quaternion into a quaternion representation (using a designated separator and a number style and a format provider), returns false if string was invalid.
/// </summary>
Tries to convert the string representation of the quaternion into a quaternion representation (using a designated separator and a number style and a format provider), returns false if string was invalid.
Tries to convert the string representation of the quaternion into a quaternion representation ( using a designated separator and a number style and a format provider ) returns false if string was invalid .
public static bool TryParse(string s, string sep, NumberStyles style, IFormatProvider provider, out quat result)
        {
            result = Zero;
            if (string.IsNullOrEmpty(s)) return false;
            var kvp = s.Split(new[] { sep }, StringSplitOptions.None);
            if (kvp.Length != 4) return false;
            float x = 0f, y = 0f, z = 0f, w = 0f;
            var ok = ((float.TryParse(kvp[0].Trim(), style, provider, out x) && float.TryParse(kvp[1].Trim(), style, provider, out y)) && (float.TryParse(kvp[2].Trim(), style, provider, out z) && float.TryParse(kvp[3].Trim(), style, provider, out w)));
            result = ok ? new quat(x, y, z, w) : Zero;
            return ok;
        }
public static bool TryParse ( string s , string sep , NumberStyles style , IFormatProvider provider , out quat result ) { result = Zero ; if ( string . IsNullOrEmpty ( s ) ) return false ; var kvp = s . Split ( new [ ] { sep } , StringSplitOptions . None ) ; if ( kvp . Length != 4 ) return false ; float x = 0f , y = 0f , z = 0f , w = 0f ; var ok = ( ( float . TryParse ( kvp [ 0 ] . Trim ( ) , style , provider , out x ) && float . TryParse ( kvp [ 1 ] . Trim ( ) , style , provider , out y ) ) && ( float . TryParse ( kvp [ 2 ] . Trim ( ) , style , provider , out z ) && float . TryParse ( kvp [ 3 ] . Trim ( ) , style , provider , out w ) ) ) ; result = ok ? new quat ( x , y , z , w ) : Zero ; return ok ; }
Tries to convert the string representation of the quaternion into a quaternion representation (using a designated separator and a number style and a format provider), returns false if string was invalid.
Tries to convert the string representation of the quaternion into a quaternion representation ( using a designated separator and a number style and a format provider ) returns false if string was invalid .
s
string
<not_specific>
sep
string
<not_specific>
style
NumberStyles
<not_specific>
provider
IFormatProvider
<not_specific>
quat
out
<not_specific>