New Plugin: CR_StringFormatter

Another CodeRush Feature Workshop (Part 1 and Part 2) has yielded a plugin, and this one is truly awesome.

String Formatter works in 3 separate ways to increase your productivity:

Tab to Next Reference Extension

Tab among references to a string token and variable/expression whose value will replace it at runtime.

Simply place the caret on a String.Format token (ie {0}) and then press the Tab key.

The Tab to Next Reference engine is engaged, and the user may now tab between references to the token, and the argument which will be used to fill it at run-time.

Note: For now, this new Tab To Next Reference functionality will require the presence of our previous CR_PrimitiveTab plugin and it’s required configuration. We hope to address this in a future version of CodeRush.

CodeIssue - Format Item Index Too Large

Wouldn’t it be useful, if studio could let you know when you reference a token inside a String.Format, but then fail to supply a corresponding argument to fill it. The “Format Item Index Too Large” CodeIssue, highlights when the index of a token in a String.Format string references an argument which is not present.

In this example, note how the string contains references to 3 distinct tokens, {0}, {1} and {2}. However there are only 2 further arguments.


This will crash at runtime and Studio does nothing to warn you of this. CR_StringFormatter to the rescue…

See below, how CR_StringFormatter’s CodeIssue highlights the offending token as an error, and provides a message to help you understand what is wrong..


The ‘Format String’ Builder

Do you have all the FormatString notations memorized? You do ? … Really? … Wow.. Well good for you.

I don’t… Sad smile 

…but then l I don’t need to. I have CR_StringFormatter Open-mouthed smile

[Are you ready? This is even more awesome than the first 2 bits.]

The 3rd piece of awesome productivity that CR_StringFormatter provides you with, is a Format String Builder. This is a context sensitive FormatString Builder dialog.

It’s like our Color swatch dialog, only for format strings and is is available when the your caret is within a String.Format token. (ie {0})

Simply choose "Format Item..." from the Code SmartTagMenu. 



When “Format Item…” is chosen, the user is presented with a dialog designed to aid them in the building of a Format String suitable for their needs.

This dialog works with String, Ints, Real (floating point) numbers , Dates and Times. Depending on the type of data being dealt with, you can expect to be given help with alignment, leading or trailing zeros, decimal places, currency, hex conversion and more.

Go on, drink it in…


Upon acceptance, this carefully crafted string will replace the original token in the string from which the dialog was requested.

Isn’t that awesome. Yet more information that you don’t have to remember (or go look up) every time you need it.

Now download from the community site, and be sure to keep an eye out for more CodeRush Feature Workshops

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.