Files
UnrealEngineUWP/Engine/Source/Programs/DotNETCommon/DotNETUtilities/StringUtils.cs
ben marsh 80bced1121 Fix issues with mismatched solution/project configurations.
* Every C++ project now has an "invalid" configuration. Trying to build any solution configuration which does not apply to the project will now build that, which prints an error rather than building a completely different configuration.
* Available configurations are now parsed from C# files, so the "Release" configuration will now be used if "Development" is not available, and platforms are supported correctly.
* Programs are now built in game and editor configurations.

#rb none
#jira UE-59288

#ROBOMERGE-SOURCE: CL 4432766 in //UE4/Release-4.21/...
#ROBOMERGE-BOT: RELEASE (Release-4.21 -> Release-Staging-4.21)

[CL 4432767 by ben marsh in Staging-4.21 branch]
2018-10-05 14:20:40 -04:00

50 lines
1.4 KiB
C#

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tools.DotNETCommon
{
public static class StringUtils
{
/// <summary>
/// Extension method to allow formatting a string to a stringbuilder and appending a newline
/// </summary>
/// <param name="Builder">The string builder</param>
/// <param name="Format">Format string, as used for StringBuilder.AppendFormat</param>
/// <param name="Args">Arguments for the format string</param>
public static void AppendLine(this StringBuilder Builder, string Format, params object[] Args)
{
Builder.AppendFormat(Format, Args);
Builder.AppendLine();
}
/// <summary>
/// Case-sensitive replacement for String.EndsWith(), which seems to be pathalogically slow on Mono.
/// </summary>
/// <param name="Source">String to test</param>
/// <param name="Suffix">Suffix to check for</param>
/// <returns>True if the source string ends with the given suffix</returns>
public static bool FastEndsWith(string Source, string Suffix)
{
if(Source.Length < Suffix.Length)
{
return false;
}
int SourceBase = Source.Length - Suffix.Length;
for(int Idx = 0; Idx < Suffix.Length; Idx++)
{
if(Source[SourceBase + Idx] != Suffix[Idx])
{
return false;
}
}
return true;
}
}
}