forked from belucha/oxyplot.blazor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for different line break symbols in tracker (closes beluc…
…ha#15 by archer0302)
- Loading branch information
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="BlazorSvgRenderContext.cs" company="OxyPlot"> | ||
// Copyright (c) 2014 OxyPlot contributors | ||
// </copyright> | ||
// <summary> | ||
// Provides a render context for scalable vector graphics output. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace OxyPlot.Blazor | ||
{ | ||
using System.Text.RegularExpressions; | ||
|
||
internal partial class Helpers | ||
{ | ||
#if NET7_0_OR_GREATER | ||
[GeneratedRegex("(\r\n|\n|\r)", RegexOptions.CultureInvariant)] | ||
private static partial Regex LineSplitterRegex(); | ||
#endif | ||
|
||
/// <summary> | ||
/// Splits the text at \r\n or \n or \r into multiple lines | ||
/// </summary> | ||
/// <param name="input"></param> | ||
/// <returns>the array of lines</returns> | ||
public static string[] SplitToLines(string input) | ||
{ | ||
#if NET7_0_OR_GREATER | ||
return LineSplitterRegex().Split(input); | ||
#else | ||
return Regex.Split(input, "(\r\n|\n|\r)", RegexOptions.Compiled | RegexOptions.CultureInvariant); | ||
#endif | ||
} | ||
} | ||
} |