I have a specification I need to follow (for a little project) and I want to ask if they my way of thinking on how to tackle this spec is correct. It's regarding C#.


  1. consume a TEXT file (.txt) from a local folder
  2. Provide the ability to:
    • strip all vowels
    • remove all non-alpha characters
    • replace a specific string (using a regular expression) with xxxxxx

Processing requirements:

  1. import the entire file into memory
  2. parse the contents and remove / strip / replace

Output requirements

  1. write out a single TEXT file as OriginalName + Parsed.txt

The text file should contain

Original file (unprocessed), at the end of this section add a summary with count of ALL words and characters.

divider --------------- to separate the unprocessed from the processed

the processed data, at end of section add summary with count of ALL words and characters.

OK here is my way of tackling it:

import a blank text file which will be saved as OriginalName + _Parsed.txt and include the same line in the text file with the summary... then the divider ------... then the processed line where the vowels, non alpha characters are removed, and specific string is replaced with xxxxx. Also includes it summary Does that seem like the right way going about it? I want to ask what is a regular expression and what should the final line look like so I can match it?

Also one final thing, it says ensure the compiled version of the application can be tested on windows 8.1.64bit that does not have visual studio installed. I'm doing it on visual studio but should I perform the application on C# console application so they can see it without needing Visual Studio? It does say debug with command line and no GUI involved.

  • 2
    A console app could still be dependant on Visual Studio, so I'd ignore that personally. I doubt you have the skills required to make an app dependant on VS being installed. Debug with the command line makes absolutely no sense at all. Jun 9, 2015 at 12:11
  • "ensure the compiled version of the application can be tested on windows 8.1.64bit that does not have visual studio installed" -> This probably means to compile your app on a .NET Framework that is natively installed on Windows 8.1...so the client wouldn't need to have Visual Studio on the computer (which would install all of the .NET Frameworks supported) or to install a separate .NET Framework version
    – Tyress
    Jun 9, 2015 at 12:22
  • 4
    That's a very poorly written spec. Jun 9, 2015 at 17:02
  • 1
    Thank you guys for your comments, much appreciated. The only thing I need to know now is how to tackle the spec. It is for a job placement so tat is why I cannot ask my employer as I don't want him to think I need help (even though I do) so if anyone can guide me to the right direction I how to tackle the spec then I can start coding. Again thank you for this.
    – TIS
    Jun 10, 2015 at 3:12
  • 2
    You don't get that strip all vowels and non-alpha is the same as keep consonants? There is no purpose to import the entire file into memory. The processed data is one word - you have stripped out all word breaks. That is either a really silly spec or testing your ability to break down a problem statement. Debug with command line?
    – paparazzo
    Jul 19, 2015 at 17:39

1 Answer 1


Seeing as you need(ed) it for "a job placement", I've provided a VB.NET LinqPad "program" that does not address some of the spec, and yet it also highlights some issues with the spec:

Sub Main
    Dim Filename = "T:\Temp\SomeTextFile.txt"
    Dim content = ReadFile(Filename)
    Using output=CreateFile(ParsedName(Filename))
    ENd Using
End Sub

' Define other methods and classes here
Function ReadFile(ByVal Filename as String) As IEnumerable(Of String)
  Return File.ReadAllLines(Filename)
End Function

Function CreateFile(ByVal Filename as String) As TextWriter
  Return File.CreateText(Filename)
End Function

Function ParsedName(ByVal Filename as String) As String
  Return Path.Combine(Path.GetDirectoryName(FileName), _
    Path.GetFileNameWithoutExtension(Filename) & "_Parsed" _
      & Path.GetExtension(Filename))
End Function

Sub WriteContentWithSummary(ByVal Output as TextWriter, _
                            ByVal Content As IEnumerable(Of String))
  Dim words = 0
  Dim chars = 0
  For each line in Content
  Output.WriteLine("Words: {0} Chars: {1}", words, chars)
End Sub

Function Parse(ByVal Content As IEnumerable(Of String)) As IEnumerable(Of String)
  Return From l In Content _
         Let noVowels = StripVowels(l), _
             onlyAlpha=StripNonAlpha(noVowels) _
         Select Regex.Replace(onlyAlpha,"BDWRD","xxxxxx")
End Function

Function StripVowels(Byval Line As String) As String
  Return Regex.Replace(Line,"[AEIOUaeiou]+", "")
End Function

Function StripNonAlpha(Byval Line As String) As String
  Return Regex.Replace(Line,"[^A-Za-z]+", "")
End Function

The main issue it highlights is that if you don't read the spec as requiring parameters to choose which of point 2's abilities are applied, then the number of words for the parsed text should be 0 or 1 because really the newlines should go too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.