Library/PackageCache/com.unity.quicksearch@1.6.0-preview.8/Editor/SearchUtils.cs
/// <summary>
/// Split a file entry according to a list of separators and find all the variations on the entry name.
/// </summary>
/// <param name="path"></param>
/// <param name="entrySeparators"></param>
/// <returns>Returns list of tokens and variations in lowercase</returns>
Split a file entry according to a list of separators and find all the variations on the entry name.
Split a file entry according to a list of separators and find all the variations on the entry name .
public static IEnumerable<string> SplitFileEntryComponents(string path, char[] entrySeparators)
        {
            var name = Path.GetFileName(path);
            var nameTokens = name.Split(entrySeparators).Distinct().ToArray();
            var scc = nameTokens.SelectMany(s => SplitCamelCase(s)).Where(s => s.Length > 0).ToArray();
            var fcc = scc.Aggregate("", (current, s) => current + s[0]);
            return Enumerable.Empty<string>()
                             .Concat(scc.Where(s => s.Length > 1))
                             .Concat(new[] { name, Path.GetExtension(path).Replace(".", "") })
                             .Concat(FindShiftLeftVariations(fcc))
                             .Concat(nameTokens)
                             .Concat(path.Split(entrySeparators).Reverse())
                             .Where(s => s.Length > 1)
                             .Select(s => s.ToLowerInvariant())
                             .Distinct();
        }
public static IEnumerable < string > SplitFileEntryComponents ( string path , char [ ] entrySeparators ) { var name = Path . GetFileName ( path ) ; var nameTokens = name . Split ( entrySeparators ) . Distinct ( ) . ToArray ( ) ; var scc = nameTokens . SelectMany ( s => SplitCamelCase ( s ) ) . Where ( s => s . Length > 0 ) . ToArray ( ) ; var fcc = scc . Aggregate ( " " , ( current , s ) => current + s [ 0 ] ) ; return Enumerable . Empty < string > ( ) . Concat ( scc . Where ( s => s . Length > 1 ) ) . Concat ( new [ ] { name , Path . GetExtension ( path ) . Replace ( " " , " " ) } ) . Concat ( FindShiftLeftVariations ( fcc ) ) . Concat ( nameTokens ) . Concat ( path . Split ( entrySeparators ) . Reverse ( ) ) . Where ( s => s . Length > 1 ) . Select ( s => s . ToLowerInvariant ( ) ) . Distinct ( ) ; }
Split a file entry according to a list of separators and find all the variations on the entry name.
Split a file entry according to a list of separators and find all the variations on the entry name .
Returns list of tokens and variations in lowercase
Returns list of tokens and variations in lowercase
path
string
None
entrySeparators
char[]
None