Skip to content

Commit

Permalink
Replace string into char.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 21, 2024
1 parent 1fd4bd8 commit df0a33f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static KeyValuePair<TimeTag, RomanisationGenerateResult> ParseRomanisatio
{
var result = new RomanisationGenerateResult
{
FirstSyllable = str.StartsWith("^", StringComparison.Ordinal),
FirstSyllable = str.StartsWith('^'),
RomanisedSyllable = str.Replace("^", ""),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static TimeTag ParseTimeTag(string? str)
var state = result.GetGroupValue<string>("state") == "start" ? TextIndex.IndexState.Start : TextIndex.IndexState.End;
int? time = result.GetGroupValue<int?>("time");
string? text = result.GetGroupValue<string?>("text");
bool? firstSyllable = text?.StartsWith("^");
bool? firstSyllable = text?.StartsWith('^');

return new TimeTag(new TextIndex(index, state), time)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line)
// add translation queue
translations.Add(line);
}
else if (line.StartsWith("@", StringComparison.Ordinal))
else if (line.StartsWith('@'))
{
// Remove @ in time tag and add into lrc queue
lrcLines.Add(line[1..]);
Expand Down Expand Up @@ -127,7 +127,7 @@ private void processNotes(Beatmap beatmap, IList<string> lines)
var defaultNote = defaultNotes[i];

// Support multi note in one time tag, format like ([1;0.5;か]|1#|...)
if (!note.StartsWith("(", StringComparison.Ordinal) || !note.EndsWith(")", StringComparison.Ordinal))
if (!note.StartsWith('(') || !note.EndsWith(')'))
{
// Process and add note
applyNote(defaultNote, note);
Expand All @@ -147,7 +147,7 @@ private void processNotes(Beatmap beatmap, IList<string> lines)
string? ruby = defaultNote.RubyText?.ElementAtOrDefault(j).ToString();

// Format like [1;0.5;か]
if (note.StartsWith("[", StringComparison.Ordinal) && note.EndsWith("]", StringComparison.Ordinal))
if (note.StartsWith('[') && note.EndsWith(']'))
{
string[] rubyNoteProperty = note.Replace("[", string.Empty).Replace("]", string.Empty).Split(';');

Expand Down

0 comments on commit df0a33f

Please sign in to comment.