17 lines
569 B
C#
17 lines
569 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace Microsoft.AspNetCore.Routing.TestObjects
|
|
{
|
|
public class SlugifyParameterTransformer : IOutboundParameterTransformer
|
|
{
|
|
public string TransformOutbound(object value)
|
|
{
|
|
// Slugify value
|
|
return value == null ? null : Regex.Replace(value.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
|
|
}
|
|
}
|
|
}
|