Skip to content

Commit 3342703

Browse files
knuhauoskogstad
andauthored
feat: Change party identifier separator to single colon (#746)
<!--- Provide a general summary of your changes in the Title above --> ## Description Change party identifier separator to single colon <!--- Describe your changes in detail --> ## Related Issue(s) - #700 ## Verification - [x] **Your** code builds clean without any errors or warnings - [x] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) Co-authored-by: Ole Jørgen Skogstad <skogstad@softis.net>
1 parent 1edd459 commit 3342703

File tree

8 files changed

+1346
-26
lines changed

8 files changed

+1346
-26
lines changed

src/Digdir.Domain.Dialogporten.Domain/Parties/Abstractions/PartyIdentifier.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ public static class PartyIdentifier
77
{
88
private delegate bool TryParseDelegate(ReadOnlySpan<char> value, [NotNullWhen(true)] out IPartyIdentifier? identifier);
99
private static readonly Dictionary<string, TryParseDelegate> TryParseByPrefix = CreateTryParseByPrefix();
10-
public const string Separator = "::";
10+
public const string Separator = ":";
1111

1212
public static string Prefix(this IPartyIdentifier identifier)
1313
=> identifier.FullId[..(identifier.FullId.IndexOf(identifier.Id, StringComparison.Ordinal) - Separator.Length)];
1414

1515
public static bool TryParse(ReadOnlySpan<char> value, [NotNullWhen(true)] out IPartyIdentifier? identifier)
1616
{
1717
identifier = null;
18-
var separatorIndex = value.IndexOf(Separator);
18+
var separatorIndex = value.LastIndexOf(Separator);
1919
if (separatorIndex == -1)
2020
{
2121
return false;
@@ -28,7 +28,7 @@ public static bool TryParse(ReadOnlySpan<char> value, [NotNullWhen(true)] out IP
2828

2929
internal static ReadOnlySpan<char> GetIdPart(ReadOnlySpan<char> value)
3030
{
31-
var separatorIndex = value.IndexOf(Separator);
31+
var separatorIndex = value.LastIndexOf(Separator);
3232
return separatorIndex == -1
3333
? value
3434
: value[(separatorIndex + Separator.Length)..];

0 commit comments

Comments
 (0)