Remove extra white space in filename


In the filename an extra whitespace character is inserted before the extension dot. This should not be there.
Example: "capture_02-26-2009-12-47-37 .Png"

file attachments

Closed Jul 19, 2013 at 12:46 AM by TerryHughes
Reason for closure:
  • There was no additional feedback regarding the template used to save the capture. As stated in a comment, trimming the file name may not be what the user wants (as they may explicitly want an ending space).
If this is still a problem, please open a new issue.


TerryHughes wrote Sep 29, 2009 at 8:09 AM

What is the template name that you are using? I setup a template of 'capture_{date}-{time}' and it produced 'capture_09-29-2009-12-04-02 AM'. It appears as though you are missing the AM/PM what are the regional time settings on your machine? Also, know that a user could specify an ending space in the template.

TobyLiu wrote Nov 1, 2009 at 5:51 AM

Can we fix the extra whitespace by using TrimEnd()?

startNames.FullSize = startNames.FullSize.Replace(Templates.Time, DateTime.Now.ToString("hh-mm-ss tt")).TrimEnd();
        startNames.Thumbnail = startNames.Thumbnail.Replace(Templates.Time, DateTime.Now.ToString("hh-mm-ss tt")).TrimEnd();

wrote Nov 1, 2009 at 5:51 AM

TerryHughes wrote Nov 1, 2009 at 7:06 AM

The problem that I have is that the name is derived from a template provided by the user. If the user actually wants a space at the end then we should respect that. If you notice that you have a space at the end and don't want it, then remove it from the template.

Again, using what I believe migu used as the template worked fine for me. It appears as though the AM/PM didn't make it in the name for some reason. If we can identify why, then we have something to fix.

wrote Nov 27, 2009 at 4:53 AM

wrote Feb 22, 2013 at 1:26 AM

wrote Jul 19, 2013 at 12:46 AM