string.join("" -> string.concat

This commit is contained in:
Kwoth 2016-07-21 12:57:57 +02:00
parent f1cf11ae8e
commit ee415d166e
6 changed files with 8 additions and 8 deletions

View File

@ -46,10 +46,10 @@ namespace NadekoBot.Extensions
if (num == 0) if (num == 0)
return string.Empty; return string.Empty;
if (num <= 3) if (num <= 3)
return string.Join("", str.Select(c => '.')); return string.Concat(str.Select(c => '.'));
if (str.Length < num) if (str.Length < num)
return str; return str;
return string.Join("", str.Take(num - 3)) + (hideDots ? "" : "..."); return string.Concat(str.Take(num - 3)) + (hideDots ? "" : "...");
} }
/// <summary> /// <summary>
/// Removes trailing S or ES (if specified) on the given string if the num is 1 /// Removes trailing S or ES (if specified) on the given string if the num is 1
@ -237,7 +237,7 @@ namespace NadekoBot.Extensions
public static string Matrix(this string s) public static string Matrix(this string s)
=> =>
string.Join("", s.Select(c => c.ToString() + " ̵̢̬̜͉̞̭̖̰͋̉̎ͬ̔̇̌̀".TrimTo(rng.Next(0, 12), true))); string.Concat(s.Select(c => c.ToString() + " ̵̢̬̜͉̞̭̖̰͋̉̎ͬ̔̇̌̀".TrimTo(rng.Next(0, 12), true)));
//.Replace("`", ""); //.Replace("`", "");
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)

View File

@ -384,7 +384,7 @@ namespace NadekoBot.Classes
{ {
var i = 0; var i = 0;
return "```xl\n" + string.Join("\n", items.GroupBy(item => (i++) / cols) return "```xl\n" + string.Join("\n", items.GroupBy(item => (i++) / cols)
.Select(ig => string.Join("", ig.Select(el => howToPrint(el))))) .Select(ig => string.Concat(ig.Select(el => howToPrint(el)))))
+ $"\n```"; + $"\n```";
} }
} }

View File

@ -146,7 +146,7 @@ namespace NadekoBot.Modules.Gambling.Helpers
var orderedPool = cardPool.OrderBy(x => r.Next()); var orderedPool = cardPool.OrderBy(x => r.Next());
cardPool = cardPool as List<Card> ?? orderedPool.ToList(); cardPool = cardPool as List<Card> ?? orderedPool.ToList();
} }
public override string ToString() => string.Join("", cardPool.Select(c => c.ToString())) + Environment.NewLine; public override string ToString() => string.Concat(cardPool.Select(c => c.ToString())) + Environment.NewLine;
private static void InitHandValues() private static void InitHandValues()
{ {

View File

@ -25,7 +25,7 @@ namespace NadekoBot.Modules.Searches.Commands
string.Join("\n", JsonConvert.DeserializeObject<Dictionary<string, string>>(await SearchHelper.GetResponseStringAsync("http://memegen.link/templates/")) string.Join("\n", JsonConvert.DeserializeObject<Dictionary<string, string>>(await SearchHelper.GetResponseStringAsync("http://memegen.link/templates/"))
.Select(kvp => Path.GetFileName(kvp.Value)) .Select(kvp => Path.GetFileName(kvp.Value))
.GroupBy(item => (i++) / 4) .GroupBy(item => (i++) / 4)
.Select(ig => string.Join("", ig.Select(el => $"{el,-17}")))) .Select(ig => string.Concat(ig.Select(el => $"{el,-17}"))))
+ $"\n```").ConfigureAwait(false); + $"\n```").ConfigureAwait(false);
}); });

View File

@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Translator.Helpers
text = await http.GetStringAsync(url).ConfigureAwait(false); text = await http.GetStringAsync(url).ConfigureAwait(false);
} }
return (string.Join("", JArray.Parse(text)[0].Select(x => x[0]))); return (string.Concat(JArray.Parse(text)[0].Select(x => x[0])));
} }
#endregion #endregion

View File

@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility
if (arr.Length == 0) if (arr.Length == 0)
await e.Channel.SendMessage("Nobody. (not 100% sure)").ConfigureAwait(false); await e.Channel.SendMessage("Nobody. (not 100% sure)").ConfigureAwait(false);
else else
await e.Channel.SendMessage("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Join("", ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false); await e.Channel.SendMessage("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "inrole") cgb.CreateCommand(Prefix + "inrole")