Skip to content

Instantly share code, notes, and snippets.

@kstmasa
Created November 14, 2019 03:28
Show Gist options
  • Save kstmasa/c6088316f14611c272584c2d99eb62e9 to your computer and use it in GitHub Desktop.
Save kstmasa/c6088316f14611c272584c2d99eb62e9 to your computer and use it in GitHub Desktop.
Split WEBVTT with string input.
/// <summary>
/// Split WEBVTT with string input.
/// </summary>
/// <param name="input"></param>
/// <param name="linefeed"></param>
/// <returns> content </returns>
public static string SplitWEBVTT(string input ,bool linefeed){
string content = "";
string linefeedtext = linefeed? "\r\n\r\n" : "\r\n";
foreach(var myString in input.Split("\r\n".ToCharArray(),StringSplitOptions.RemoveEmptyEntries)){
if(myString.Contains("-->")){
continue;
}
content+= myString + linefeedtext;
}
return content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment