locked
Padding a string

    Question

  • How I can a string containing a number with 2 leading zeros?

    Thanks!

    Sunday, April 28, 2013 5:57 PM

Answers

  • I found a workaround:

    if(hour -> Lenght() < 2)
       hour = hour -> Concat("0", hour);

    If anyone has a better solution, please share it!

    • Marked as answer by Jesse Jiang Tuesday, April 30, 2013 2:08 AM
    Sunday, April 28, 2013 6:12 PM

All replies

  • I found a workaround:

    if(hour -> Lenght() < 2)
       hour = hour -> Concat("0", hour);

    If anyone has a better solution, please share it!

    • Marked as answer by Jesse Jiang Tuesday, April 30, 2013 2:08 AM
    Sunday, April 28, 2013 6:12 PM
  • Thanks for sharing the solution.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 30, 2013 2:09 AM