Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
Questioncompare two textboxes (string) - need help Pin
mar malaza11-Sep-16 1:04
mar malaza11-Sep-16 1:04 
GeneralRe: compare two textboxes (string) - need help Pin
harold aptroot11-Sep-16 1:41
harold aptroot11-Sep-16 1:41 
AnswerRe: compare two textboxes (string) - need help Pin
#realJSOP11-Sep-16 3:30
mve#realJSOP11-Sep-16 3:30 
AnswerRe: compare two textboxes (string) - need help Pin
V.11-Sep-16 21:10
professionalV.11-Sep-16 21:10 
QuestionHow is check the date of a valid dateEdit ? Pin
Member 245846710-Sep-16 23:42
Member 245846710-Sep-16 23:42 
AnswerRe: How is check the date of a valid dateEdit ? Pin
OriginalGriff11-Sep-16 0:03
mveOriginalGriff11-Sep-16 0:03 
AnswerRe: How is check the date of a valid dateEdit ? Pin
#realJSOP11-Sep-16 3:21
mve#realJSOP11-Sep-16 3:21 
QuestionGroup Sequance patterns with Linq Pin
Member 121069269-Sep-16 1:27
Member 121069269-Sep-16 1:27 
I have been working on finding case numbers in strings based on user inputted pattern. The pattern is build up by using the Characters D=Decimal , A=Aplha ,- = seperator.
This can be anywhere from DDDAAAA or DDDD-AAAA-DA-AD, most common case would be DDDD-DDDD or DDAA-DDDD , Note that a separator is not mandatory.
I have written an old-school void that creates a list of strings that represent the sequences in the pattern. For the pattern DDAA-DDD i would return this.
new List {DD,AA,-,DDD}
And then use the list to find my matches (different story)

Q: I have been trying to figure out how to do this using linq queries.

What I have so far is sort of on point, but only partialy.
C#
var pattern = "DDDD-AA-DD";
var patternlist = pattern.GroupBy(x => x)
                                .Where(g => g.Count() > 1)
                                .Select(y => new { Element = y, Counter = y.Count() });

This will not create a separate group for all the patterns or sequences. This will only tell me that I have 6 instances of D , 2 instances of A and 2 instances of -.

I wanted to find an elegant solution to this, where I could return something like a group per sequence of a char. Note I would not want to use the values of the chars or reference the known values.
I’m not looking for something like this.
C#
if (pattern.StartsWith("A"))
 {
       var tst = pattern.TakeWhile(p => p == 'C');
 }
//ect


Any takers 
AnswerRe: Group Sequance patterns with Linq Pin
Richard Deeming9-Sep-16 2:02
mveRichard Deeming9-Sep-16 2:02 
GeneralRe: Group Sequance patterns with Linq Pin
Member 121069269-Sep-16 2:10
Member 121069269-Sep-16 2:10 
AnswerRe: Group Sequance patterns with Linq Pin
#realJSOP9-Sep-16 2:14
mve#realJSOP9-Sep-16 2:14 
GeneralRe: Group Sequance patterns with Linq Pin
Member 121069269-Sep-16 2:19
Member 121069269-Sep-16 2:19 
GeneralRe: Group Sequance patterns with Linq Pin
#realJSOP9-Sep-16 2:25
mve#realJSOP9-Sep-16 2:25 
GeneralRe: Group Sequance patterns with Linq Pin
Member 121069269-Sep-16 2:28
Member 121069269-Sep-16 2:28 
SuggestionRe: Group Sequance patterns with Linq Pin
Richard Deeming9-Sep-16 4:15
mveRichard Deeming9-Sep-16 4:15 
GeneralRe: Group Sequance patterns with Linq Pin
#realJSOP9-Sep-16 4:18
mve#realJSOP9-Sep-16 4:18 
GeneralRe: Group Sequance patterns with Linq Pin
Richard Deeming9-Sep-16 4:19
mveRichard Deeming9-Sep-16 4:19 
GeneralRe: Group Sequance patterns with Linq Pin
#realJSOP9-Sep-16 4:25
mve#realJSOP9-Sep-16 4:25 
AnswerRe: Group Sequance patterns with Linq Pin
Member 121069269-Sep-16 2:26
Member 121069269-Sep-16 2:26 
AnswerRe: Group Sequance patterns with Linq Pin
Gerry Schmitz9-Sep-16 13:30
mveGerry Schmitz9-Sep-16 13:30 
AnswerRe: Group Sequance patterns with Linq Pin
BillWoodruff10-Sep-16 2:34
professionalBillWoodruff10-Sep-16 2:34 
GeneralRe: Group Sequance patterns with Linq Pin
#realJSOP11-Sep-16 3:18
mve#realJSOP11-Sep-16 3:18 
GeneralRe: Group Sequance patterns with Linq Pin
BillWoodruff11-Sep-16 19:21
professionalBillWoodruff11-Sep-16 19:21 
Questionunable to bind json data in label Pin
Member 127294328-Sep-16 22:36
Member 127294328-Sep-16 22:36 
QuestionRe: unable to bind json data in label Pin
Richard MacCutchan8-Sep-16 22:40
mveRichard MacCutchan8-Sep-16 22:40 

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.