Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Determine if a string has all unique characters.
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string value1 = "Cshaptr"; string valueNew = RemoveDuplicateChars("Cshaptr"); if (value1 == valueNew) Console.WriteLine("True"); else Console.WriteLine("False"); } static string RemoveDuplicateChars(string key) { // --- Removes duplicate chars using string concats. --- // Store encountered letters in this string. string table = ""; // Store the result in this string. string result = ""; // Loop over each character. foreach (char value in key) { // See if character is in the table. if (table.IndexOf(value) == -1) { // Append to the table and the result. table += value; result += value; } } return result; } } }
run
|
edit
|
history
|
help
0
Explanation about Aggregate method in C#
Download a .NET assembly, and execute a static, parameterless method.
Collections
ConcurrentQueue<T>
Project Euler Problem 9
dfgthyjui8u7yt5rewsx
SHA加密
bc160400236
Planet-D
JagArray