Results 1 to 2 of 2

Thread: [RESOLVED] string.Format() help

  1. #1

    Thread Starter
    Addicted Member scottlafoy's Avatar
    Join Date
    Feb 2009
    Location
    Calgary Alberta, Canada
    Posts
    148

    Resolved [RESOLVED] string.Format() help

    in this method

    Code:
    private string ConvertLSDToPrettyPrintLocation(string location)
            {
               string prettyLocation = string.Format("{0:##-00-000-00W0}", Convert.ToInt32(location));
    
                return (prettyLocation);
            }
    if i enter 1234567890 I get 12-34-567-89W0
    but when I enter 12345678 i get -12-345-67W8 and I want 12-345-67W8

    How do I get rid of the leading - when there are only 8 numbers entered

    Thank you for any advice

    Scott
    C:\DOS
    C:\DOS\RUN
    RUN\DOS\RUN

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: string.Format() help

    I'm unsure if there is a way to do it directly with |string.Format()|. But you could always check the that location.length and use one variant for 8 char strings and another for lower character numbered strings.

    Cheers.
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width