Skip to content

Commit

Permalink
feat: Change party identifier separator to single colon (#746)
Browse files Browse the repository at this point in the history
<!--- 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>
  • Loading branch information
knuhau and oskogstad authored May 21, 2024
1 parent 1edd459 commit 3342703
Show file tree
Hide file tree
Showing 8 changed files with 1,346 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public static class PartyIdentifier
{
private delegate bool TryParseDelegate(ReadOnlySpan<char> value, [NotNullWhen(true)] out IPartyIdentifier? identifier);
private static readonly Dictionary<string, TryParseDelegate> TryParseByPrefix = CreateTryParseByPrefix();
public const string Separator = "::";
public const string Separator = ":";

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

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

internal static ReadOnlySpan<char> GetIdPart(ReadOnlySpan<char> value)
{
var separatorIndex = value.IndexOf(Separator);
var separatorIndex = value.LastIndexOf(Separator);
return separatorIndex == -1
? value
: value[(separatorIndex + Separator.Length)..];
Expand Down
Loading

0 comments on commit 3342703

Please sign in to comment.