// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
namespace Microsoft.Graph
{
using System.Linq;
///
/// Helper class for string casing.
///
public static class StringHelper
{
///
/// Converts the type string to title case.
///
/// The type string.
/// The converted string.
public static string ConvertTypeToTitleCase(string typeString)
{
if (!string.IsNullOrEmpty(typeString))
{
var stringSegments = typeString.Split('.').Select(
segment => string.Concat(segment.Substring(0, 1).ToUpperInvariant(), segment.Substring(1)));
return string.Join(".", stringSegments);
}
return typeString;
}
///
/// Converts the type string to lower camel case.
///
/// The type string.
/// The converted string.
public static string ConvertTypeToLowerCamelCase(string typeString)
{
if (!string.IsNullOrEmpty(typeString))
{
var stringSegments = typeString.Split('.').Select(
segment => string.Concat(segment.Substring(0, 1).ToLowerInvariant(), segment.Substring(1)));
return string.Join(".", stringSegments);
}
return typeString;
}
///
/// Converts the identifier string to lower camel case.
///
/// The identifier string.
/// The converted string.
public static string ConvertIdentifierToLowerCamelCase(string identifierString)
{
if (!string.IsNullOrEmpty(identifierString))
{
return string.Concat(identifierString.Substring(0, 1).ToLowerInvariant(), identifierString.Substring(1));
}
return identifierString;
}
}
}