Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A string is a sequence of characters. It is commonly used to represent text or a sequence of bytes. Use this tag along with the appropriate programming language being used.
6
votes
2
answers
1k
views
Named string interpolation
On machines where I don't have C# 6 I use this named string interpolation method. I tried to make it as pretty a possible as far as good coding practices are concerned but I just can't get rid of the …
4
votes
2
answers
121
views
Enumerating text (ranges) vertically and horizontally
I'm writing a parser and I need to iterate through text vertically (down to bottom) and horizontally (left to right).
This alone would be easy but some text parts need to be rescanned by another pars …
10
votes
1
answer
2k
views
Custom string formatters
Some time ago I was experimenting with an Extendable format provider but I wasn't satisfied with the implementation. It didn't feal very SOLID so I've rewritten it to this:
The base class is the Form …
13
votes
3
answers
1k
views
Building DebuggerDisplay strings
But creating those strings is an extremely tedious task. … It formats strings by quoting them with single quotes. Numbers don't get any. …
3
votes
1
answer
251
views
Extendable format provider
I needed a better string formatting options like ToUpper and ToLower but I also wanted to be able to use the default formattings so I created a custom formatter. It's main purpose is to support a temp …
3
votes
2
answers
1k
views
Case insensitive string to replace custom comparers
In some solutions I use case-insensitive strings a lot and so far I've been always writing custom collections or using custom comparers to support them. … I use it for hash-sets or dictionaries or anything else that might require case insensitive strings. …
5
votes
4
answers
2k
views
Fast case-insensitive hash-code for specific codes
I'm trying to fix another bottleneck identified with a profiler (dotTrace). This time it's a case insensitive hash-code.
Currently I'm using the StringComparer.OrdinalIgnoreCase as a comparer for a …
6
votes
1
answer
537
views
Rendering tree of nodes as string
I'm creating a debug-view for my expression-trees. They record each operation automatically in a tree that I am transforming into string so that I can see the exact evaluation of expressions.
Tree( …
4
votes
2
answers
2k
views
ExceptionPrettifier for prettier exception strings
I've been refining my previous idea for pretty exception strings and made the following changes:
Exceptions can be ordered.
Prints all properties including Data. … ++;
exceptionStack.Push(new Node<Exception>(current.Value.InnerException, depth));
depth--;
}
}
}
}
The reflection helper creates pretty type strings …
6
votes
2
answers
233
views
Is there a circular reference in a set of template substitutions?
var constants = new Dictionary<string, object>
{
{ "x", "foo {y} baz" },
{ "y", "bar {x} qux" },
};
These are just two sample strings to show how it can look like. … The real configuration contains connection strings, email lists, user names, sql etc. …
1
vote
1
answer
5k
views
Custom Exception.ToString() formatter
I find the default Exception.ToString() formattig very difficult to read especially if there are inner exceptions involved. I guess everyone knows how it looks:
System.ArgumentException: This is a me …