From 68cd2c310a99acfd4f7e30501f12ca5d0d43fbc9 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Tue, 7 Jan 2025 22:09:53 +0800 Subject: [PATCH] fix(strings): fix fill character cannot be defaulted --- .../Source/Public/Strings/Formatting.h | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Strings/Formatting.h b/Redcraft.Utility/Source/Public/Strings/Formatting.h index 5bfe6b4..5ab07df 100644 --- a/Redcraft.Utility/Source/Public/Strings/Formatting.h +++ b/Redcraft.Utility/Source/Public/Strings/Formatting.h @@ -549,12 +549,17 @@ public: { if (Iter == Sent) break; - if (*Iter != LITERAL(FCharType, '<') && *Iter != LITERAL(FCharType, '^') && *Iter != LITERAL(FCharType, '>')) break; + // If the fill character is specified. + if (*Iter == LITERAL(FCharType, '<') || *Iter == LITERAL(FCharType, '^') || *Iter == LITERAL(FCharType, '>')) + { + FillUnitLength = 1; + FillCharacter[0] = Char; - FillUnitLength = 1; - FillCharacter[0] = Char; + Char = *Iter; ++Iter; + } - Char = *Iter; ++Iter; + // If the fill character is not specified and the align option is not specified. + else if (Char != LITERAL(FCharType, '<') && Char != LITERAL(FCharType, '^') && Char != LITERAL(FCharType, '>')) break; AlignOption = Char; @@ -1232,12 +1237,17 @@ public: { if (Iter == Sent) break; - if (*Iter != LITERAL(FCharType, '<') && *Iter != LITERAL(FCharType, '^') && *Iter != LITERAL(FCharType, '>')) break; + // If the fill character is specified. + if (*Iter == LITERAL(FCharType, '<') || *Iter == LITERAL(FCharType, '^') || *Iter == LITERAL(FCharType, '>')) + { + FillUnitLength = 1; + FillCharacter[0] = Char; - FillUnitLength = 1; - FillCharacter[0] = Char; + Char = *Iter; ++Iter; + } - Char = *Iter; ++Iter; + // If the fill character is not specified and the align option is not specified. + else if (Char != LITERAL(FCharType, '<') && Char != LITERAL(FCharType, '^') && Char != LITERAL(FCharType, '>')) break; bHasFillAndAlign = true;