mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
Trim empty entries in string split calls
This commit is contained in:
parent
bff915e304
commit
e93aea1977
3 changed files with 4 additions and 5 deletions
|
@ -57,9 +57,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? Array.Empty<string>();
|
||||
// Split() returns an array with an empty character for some reason
|
||||
if (authorLabels.Length == 1) authorLabels = Array.Empty<string>();
|
||||
authorLabels = Model.Slot?.AuthorLabels.Split(",", StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
|
||||
}
|
||||
if (authorLabels.Length == 0)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ public class ConsoleLogger : ILogger
|
|||
ConsoleColor oldForegroundColor = Console.ForegroundColor;
|
||||
ConsoleColor logColor = logLine.Level.ToColor();
|
||||
|
||||
foreach (string line in logLine.Message.Split('\n'))
|
||||
foreach (string line in logLine.Message.Split('\n', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
string time = DateTime.Now.ToString("MM/dd/yyyy-HH:mm:ss.fff");
|
||||
string trace = "";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
@ -38,7 +39,7 @@ public class Review
|
|||
[NotMapped]
|
||||
[XmlIgnore]
|
||||
public string[] Labels {
|
||||
get => this.LabelCollection.Split(",");
|
||||
get => this.LabelCollection.Split(",", StringSplitOptions.RemoveEmptyEntries);
|
||||
set => this.LabelCollection = string.Join(',', value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue