public void TestFormatting() { string test = "] [icon: someicon ] some text [token2]] other text [IC: someIC] [] [persona: gr8b]["; string res = MatrixFormatter.ApplyMatrixFormatting(test); Assert.AreEqual("] [color,-256: someicon ] some text [token2]] other text [color,-65536: someIC] [] [color,-16711681: gr8b][", res); }
/// <summary> /// Converts the string representation of a vector to its /// double-precision floating-point number vector equivalent. /// </summary> /// <param name="str">The string representation of the vector.</param> /// <param name="provider"> /// The format provider to use in the conversion. Default is to use /// <see cref="DefaultMatrixFormatProvider.CurrentCulture" />. /// </param> /// <returns> /// A double-precision floating-point number matrix parsed /// from the given string using the given format provider. /// </returns> public static double[] Parse(string str, IMatrixFormatProvider provider) { return(MatrixFormatter.ParseJagged(str, provider).Flatten()); }
/// <summary> /// Converts the string representation of a vector to its /// double-precision floating-point number vector equivalent. /// </summary> /// <param name="str">The string representation of the matrix.</param> /// <returns> /// A double-precision floating-point number matrix parsed /// from the given string using the given format provider. /// </returns> public static double[] Parse(string str) { return(MatrixFormatter.ParseJagged(str, DefaultMatrixFormatProvider.CurrentCulture).Flatten()); }
/// <summary> /// Returns a <see cref="System.String"/> representation of a a given array. /// </summary> /// /// <param name="matrix">The matrix.</param> /// /// <param name="format"> /// The format to use when creating the resulting string. /// </param> /// /// <param name="provider"> /// The <see cref="IMatrixFormatProvider"/> to be used /// when creating the resulting string. Default is to use /// <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>. /// </param> /// /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> /// /// <example> /// Please see <see cref="CSharpMatrixFormatProvider"/>, /// <see cref="OctaveArrayFormatProvider"/> or <see cref="DefaultArrayFormatProvider"/> /// for examples and more details. /// </example> /// public static string ToString<T>(this T[] matrix, string format, IMatrixFormatProvider provider) { return MatrixFormatter.Format(format, matrix, provider); }
/// <summary> /// Returns a <see cref="System.String"/> representation of a a given array. /// </summary> /// /// <param name="array">The array.</param> /// /// <param name="format"> /// The format to use when creating the resulting string. /// </param> /// /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> /// /// <example> /// Please see <see cref="CSharpMatrixFormatProvider"/>, /// <see cref="OctaveArrayFormatProvider"/> or <see cref="DefaultArrayFormatProvider"/> /// for examples and more details. /// </example> /// public static string ToString<T>(this T[] array, string format) { return MatrixFormatter.Format(format, array, DefaultArrayFormatProvider.CurrentCulture); }
/// <summary> /// Returns a <see cref="System.String"/> representation of a given matrix. /// </summary> /// /// <param name="matrix">The matrix.</param> /// /// <param name="format"> /// The format to use when creating the resulting string. /// </param> /// /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> /// /// <example> /// Please see <see cref="CSharpMatrixFormatProvider"/>, /// <see cref="CSharpJaggedMatrixFormatProvider"/>, <see cref="CSharpArrayFormatProvider"/>, /// <see cref="OctaveMatrixFormatProvider"/>, or <see cref="OctaveArrayFormatProvider"/> /// for more details. /// </example> /// public static string ToString<T>(this T[][] matrix, string format) { return MatrixFormatter.Format(format, matrix, DefaultMatrixFormatProvider.CurrentCulture); }
/// <summary> /// Converts the string representation of a matrix to its /// double-precision floating-point number matrix equivalent. /// </summary> /// <param name="str">The string representation of the matrix.</param> /// <param name="provider"> /// The format provider to use in the conversion. Default is to use /// <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>. /// </param> /// <returns>A double-precision floating-point number matrix parsed /// from the given string using the given format provider.</returns> /// public static double[,] Parse(string str, IMatrixFormatProvider provider) { return MatrixFormatter.ParseMultidimensional(str, provider); }
/// <summary> /// Converts the string representation of a matrix to its /// double-precision floating-point number matrix equivalent. /// </summary> /// <param name="str">The string representation of the matrix.</param> /// <returns>A double-precision floating-point number matrix parsed /// from the given string using the given format provider.</returns> /// public static double[,] Parse(string str) { return MatrixFormatter.ParseMultidimensional(str, DefaultMatrixFormatProvider.CurrentCulture); }
/// <summary> /// Returns a <see cref="System.String"/> that representing a matrix. /// </summary> /// <param name="matrix">The matrix.</param> /// <param name="format"> /// The format to use when creating the resulting string. /// </param> /// <param name="provider"> /// The <see cref="IMatrixFormatProvider"/> to be used /// when creating the resulting string. Default is to use /// <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>. /// </param> /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> /// public static string ToString(this double[,] matrix, string format, IMatrixFormatProvider provider) { return(MatrixFormatter.Format(format, matrix, provider)); }
/// <summary> /// Converts the string representation of a matrix to its /// double-precision floating-point number matrix equivalent. /// </summary> /// <param name="s">The string representation of the matrix.</param> /// <param name="provider"> /// The format provider to use in the conversion. Default is to use /// <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>. /// </param> /// <returns>A double-precision floating-point number matrix parsed /// from the given string using the given format provider.</returns> /// public static double[][] ParseJagged(string s, IMatrixFormatProvider provider) { return(MatrixFormatter.ParseJagged(s, provider)); }