View Helpers.cs
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
using System; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Text; | |
string str = @" | |
a1 = b1; | |
a2 = b2; | |
a3 = b3;"; |
View FilenameHelpers.cs
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
/// <summary>Creates a valid Windows filename from a string.</summary> | |
/// <param name="filename">The filename candidate.</param> | |
/// <param name="replaceInvalidCharsWith">What to replace invalid filename chars in <paramref name="filename"/> with.</param> | |
/// <returns> | |
/// A new <see cref="string"/>, equivalent to <paramref name="filename"/>, but modified to be a valid Windows filename if it | |
/// <paramref name="filename"/> wasn't already. | |
/// </returns> | |
/// <exception cref="ArgumentException"/> | |
/// <remarks>The length of the filename is not checked, and the casing is not modified.</remarks> | |
public static string ToFilename(this string filename, string replaceInvalidCharsWith = "_") |