Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Even though it's clearly weird (shouldn't "contains..." return a boolean?) and counter-intuitive (I have created an "empty" <code>FormatString</code>, i.e. nothing passed through its constructor, why should it do anything?), it doesn't strike me as entirely nonsensical. </p> <p>"containsAlpha" might as well mean: Check if parameter 1 (<code>UPCE</code> in this case) contains alphabetic (probably alphanumeric) characters. So <code>FormatString</code> would be some generic class that checks for basic characteristics of how strings are formatted, i.e. do they contain numbers, letters, special chars etc.</p> <p>It's also possible that <code>FormatString</code> is some specialized class (check the namespace?) that checks for the format of, e.g. <a href="https://en.wikipedia.org/wiki/Universal_Product_Code" rel="nofollow">UPCs</a>, and would probably better be called <code>UPCFormat</code>, <code>UPCFormatVerifier</code> etc.</p> <p>If I'm not completely mistaken, I don't recognize this as a .NET framework function. Which target framework version is this? Do you have the source of <code>FormatString</code>? What does it say?</p> <p>Anyway, a beautiful piece of strange code. ;-)</p> <p>Ziffusion's answer also makes sense, look at the construcor code. Perhaps it does more than it should, some initialization either in regard to some default state, or, even worse, something involving static global state stuff, which you never find out unless you run the whole system.</p> <p>Edit: Now read your edit - as it turns out, I was right that <code>FormatString</code> does "generic string format checking." Probably <code>StringFormat</code> would be a slightly better name, but all in all I'd say: If you want to check the format of UPCs, have either an UPC class with a static factory/builder method which builds an UPC object from a string, including format checks, or create a <code>UPCFormatCheck</code> class which solely does the job of checking specific formats. This way, you avoid all too generic names that could mean anything. (In that class you can obviously use some cool LINQ-oneliner to do the actual check, as suggested.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload