Click here to Skip to main content
15,913,055 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error when trying to make a web service client Pin
SorenBerggreen8-Sep-09 4:24
SorenBerggreen8-Sep-09 4:24 
GeneralRe: Error when trying to make a web service client Pin
SeMartens8-Sep-09 4:26
SeMartens8-Sep-09 4:26 
GeneralRe: Error when trying to make a web service client Pin
SorenBerggreen8-Sep-09 21:17
SorenBerggreen8-Sep-09 21:17 
AnswerRe: Error when trying to make a web service client Pin
SorenBerggreen8-Sep-09 21:16
SorenBerggreen8-Sep-09 21:16 
Questionhex Pin
sanforjackass8-Sep-09 2:22
sanforjackass8-Sep-09 2:22 
AnswerRe: hex Pin
Luc Pattyn8-Sep-09 2:24
sitebuilderLuc Pattyn8-Sep-09 2:24 
GeneralRe: hex Pin
DaveyM698-Sep-09 3:38
professionalDaveyM698-Sep-09 3:38 
GeneralRe: hex Pin
Luc Pattyn8-Sep-09 3:42
sitebuilderLuc Pattyn8-Sep-09 3:42 
GeneralRe: hex Pin
DaveyM698-Sep-09 4:02
professionalDaveyM698-Sep-09 4:02 
GeneralRe: hex Pin
sanforjackass8-Sep-09 4:02
sanforjackass8-Sep-09 4:02 
GeneralRe: hex Pin
Luc Pattyn8-Sep-09 4:09
sitebuilderLuc Pattyn8-Sep-09 4:09 
QuestionUpdate Cache Data Pin
sjs4u8-Sep-09 2:17
sjs4u8-Sep-09 2:17 
AnswerRe: Update Cache Data Pin
Manas Bhardwaj8-Sep-09 2:18
professionalManas Bhardwaj8-Sep-09 2:18 
GeneralRe: Update Cache Data Pin
sjs4u8-Sep-09 2:38
sjs4u8-Sep-09 2:38 
QuestionGet the automated changes from excel Pin
NarVish8-Sep-09 2:09
NarVish8-Sep-09 2:09 
QuestionSearch for repeated character combinations Pin
khalidelmeknesi8-Sep-09 2:07
khalidelmeknesi8-Sep-09 2:07 
AnswerRe: Search for repeated character combinations Pin
sanforjackass8-Sep-09 2:58
sanforjackass8-Sep-09 2:58 
GeneralRe: Search for repeated character combinations Pin
khalidelmeknesi8-Sep-09 3:08
khalidelmeknesi8-Sep-09 3:08 
AnswerRe: Search for repeated character combinations [modified] Pin
sanforjackass8-Sep-09 4:00
sanforjackass8-Sep-09 4:00 
GeneralRe: Search for repeated character combinations [modified] Pin
khalidelmeknesi16-Sep-09 22:48
khalidelmeknesi16-Sep-09 22:48 
AnswerRe: Search for repeated character combinations Pin
sanforjackass18-Sep-09 12:05
sanforjackass18-Sep-09 12:05 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CountString
{
class Program
{
static void Main(string[] args)
{
string _givenString = "wvtnfhxyz1hdxyz1fdxyz1ejxyz1dhxyz1dxyzeeaa1oeys";
Dictionary<string, int> _codes = new Dictionary<string, int>();
int _startingPoint = 0;
//while (_startingPoint < _givenString.Length)
//{
for (int j = 2; j < _givenString.Length; j++)
{
for (int i = _startingPoint; i < _givenString.Length && i + j < _givenString.Length+1; i++)
{
if (!_codes.ContainsKey(_givenString.Substring(i, j)))
{
_codes.Add(_givenString.Substring(i, j), 1);
}
else
{
_codes[_givenString.Substring(i, j)] += 1;
}
}
}
// _startingPoint++;
//}

List<KeyValuePair<string, int>> _sortedCodes = SortDictionary(_codes);
for (int i = 0; i < 5; i++)
{
Console.WriteLine(_sortedCodes[i].Key + " : " + _sortedCodes[i].Value + " times");
}
Console.ReadKey();
}

public static List<KeyValuePair<string, int>> SortDictionary(Dictionary<string, int> data)
{
List<KeyValuePair<string, int>> result =
new List<KeyValuePair<string, int>>(data);
result.Sort(
delegate(
KeyValuePair<string, int> first,
KeyValuePair<string, int> second)
{
return second.Value.CompareTo(first.Value);
}
);
return result;
}
}
}

does it work as you want??
AnswerRe: Search for repeated character combinations Pin
Ian Shlasko8-Sep-09 5:41
Ian Shlasko8-Sep-09 5:41 
GeneralRe: Search for repeated character combinations Pin
khalidelmeknesi8-Sep-09 21:48
khalidelmeknesi8-Sep-09 21:48 
QuestionRedirect Console for In-Memory Execution Pin
Anindya Chatterjee8-Sep-09 1:49
Anindya Chatterjee8-Sep-09 1:49 
AnswerRe: Redirect Console for In-Memory Execution Pin
Not Active8-Sep-09 2:19
mentorNot Active8-Sep-09 2:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.