AB4227 - Removed StringExtensions from core..
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
@@ -1396,5 +1397,54 @@ namespace Umbraco.Core
|
||||
{
|
||||
return shortStringHelper.CleanString(text, stringType, separator, culture);
|
||||
}
|
||||
|
||||
// note: LegacyCurrent.ShortStringHelper will produce 100% backward-compatible output for SplitPascalCasing.
|
||||
// other helpers may not. DefaultCurrent.ShortStringHelper produces better, but non-compatible, results.
|
||||
|
||||
/// <summary>
|
||||
/// Splits a Pascal cased string into a phrase separated by spaces.
|
||||
/// </summary>
|
||||
/// <param name="phrase">The text to split.</param>
|
||||
/// <param name="shortStringHelper"></param>
|
||||
/// <returns>The split text.</returns>
|
||||
public static string SplitPascalCasing(this string phrase, IShortStringHelper shortStringHelper)
|
||||
{
|
||||
return shortStringHelper.SplitPascalCasing(phrase, ' ');
|
||||
}
|
||||
|
||||
//NOTE: Not sure what this actually does but is used a few places, need to figure it out and then move to StringExtensions and obsolete.
|
||||
// it basically is yet another version of SplitPascalCasing
|
||||
// plugging string extensions here to be 99% compatible
|
||||
// the only diff. is with numbers, Number6Is was "Number6 Is", and the new string helper does it too,
|
||||
// but the legacy one does "Number6Is"... assuming it is not a big deal.
|
||||
internal static string SpaceCamelCasing(this string phrase, IShortStringHelper shortStringHelper)
|
||||
{
|
||||
return phrase.Length < 2 ? phrase : phrase.SplitPascalCasing(shortStringHelper).ToFirstUpperInvariant();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans a string, in the context of the invariant culture, to produce a string that can safely be used as a filename,
|
||||
/// both internally (on disk) and externally (as a url).
|
||||
/// </summary>
|
||||
/// <param name="text">The text to filter.</param>
|
||||
/// <param name="shortStringHelper"></param>
|
||||
/// <returns>The safe filename.</returns>
|
||||
public static string ToSafeFileName(this string text, IShortStringHelper shortStringHelper)
|
||||
{
|
||||
return shortStringHelper.CleanStringForSafeFileName(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans a string, in the context of the invariant culture, to produce a string that can safely be used as a filename,
|
||||
/// both internally (on disk) and externally (as a url).
|
||||
/// </summary>
|
||||
/// <param name="text">The text to filter.</param>
|
||||
/// <param name="shortStringHelper"></param>
|
||||
/// <param name="culture">The culture.</param>
|
||||
/// <returns>The safe filename.</returns>
|
||||
public static string ToSafeFileName(this string text, IShortStringHelper shortStringHelper, string culture)
|
||||
{
|
||||
return shortStringHelper.CleanStringForSafeFileName(text, culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user