Hi,
Another thing you might want to try is to check if the string actually
needs modification instead of always creating substrings and then
concatenating them, even if the result would be identical to the input.
This would be an interesting way to do it - the problem is that there
may be spa
Hi,
If you have lots of duplicates it _might_ be faster to pass a custom
comparison function to Distinct() and then fixup the resulting strings in
the tmp list afterwards instead.
Another thing you might want to try is to check if the string actually
needs modification instead of always creating
Is this running against a database? If so you can always get the SQL
that is generated by the LINQ statement and check it running the SQL
statement directly against the database and checking the number of reads
and the time. The fact that your using a distinct hints that you may be
missing a pa
Tried string.Trim(trimChars); yet?
nodoid wrote
> Hi,
>
>> can you give us some example strings?
>
> Sure.
>
> The names can be in either the form of
>
> ( foo )
> or
> (foo)
> of
> ( foo)
> or
> (foo )
>
> (though the last two are rare)
>
> Paul
> --
> "Space," it says, "is big. Really bi
Hi,
can you give us some example strings?
Sure.
The names can be in either the form of
( foo )
or
(foo)
of
( foo)
or
(foo )
(though the last two are rare)
Paul
--
"Space," it says, "is big. Really big. You just won't believe how
vastly, hugely, mindbogglingly big it is. I mean, you may th
can you give us some example strings?
On 5 June 2013 00:32, Paul Johnson wrote:
> Hi,
>
> I have a class containing ints, strings and anything else you'd expect to
> find in a class. I create a list of the class and then extract the strings
> and perform a Distinct() on them. That bit is easy.
A single Substring() (to isolate the part between brackets), then a Trim()?
Or if the word between the brackets is not supposed to contain ANY space,
maybe use the Trim overload that expects a char array parameter.
Like this (except in your LINQ query):
string word = "( hello)";
char[] trimCh
Hi,
I have a class containing ints, strings and anything else you'd expect
to find in a class. I create a list of the class and then extract the
strings and perform a Distinct() on them. That bit is easy.
Problem is this - the strings all have something in brackets. Sometimes
the braces have