Click here to Skip to main content
16,005,169 members
Home / Discussions / C#
   

C#

 
GeneralRe: Streamwriter output Pin
Pete O'Hanlon15-Mar-11 23:31
mvePete O'Hanlon15-Mar-11 23:31 
GeneralRe: Streamwriter output Pin
Pierre besquent16-Mar-11 0:52
Pierre besquent16-Mar-11 0:52 
AnswerRe: Streamwriter output Pin
Richard MacCutchan15-Mar-11 23:12
mveRichard MacCutchan15-Mar-11 23:12 
GeneralRe: Streamwriter output Pin
Pierre besquent15-Mar-11 23:23
Pierre besquent15-Mar-11 23:23 
GeneralRe: Streamwriter output Pin
Richard MacCutchan15-Mar-11 23:42
mveRichard MacCutchan15-Mar-11 23:42 
GeneralRe: Streamwriter output Pin
Pete O'Hanlon15-Mar-11 23:48
mvePete O'Hanlon15-Mar-11 23:48 
GeneralRe: Streamwriter output Pin
Pierre besquent16-Mar-11 0:09
Pierre besquent16-Mar-11 0:09 
AnswerRe: Streamwriter output Pin
Luc Pattyn16-Mar-11 0:06
sitebuilderLuc Pattyn16-Mar-11 0:06 
your code could be simplified quite a bit:

1.
formatting numbers with specified width: use custom number formatting, so replace
if (reglement.DateReglement.Month > 9)
                    strMonth = reglement.DateReglement.Month.ToString ();
                else
                    strMonth = "0" + reglement.DateReglement.Month.ToString ();

by
strMonth = reglement.DateReglement.Month.ToString ("D2");


2.
getting last character of a number: use modulo 10, so replace
string strYear = reglement.DateReglement.Year.ToString ();
s=(strYear.ToCharArray ()) [strYear.Length - 1];

by
s=(reglement.DateReglement.Year%10).ToString();


3.
FYI: If you were to require two-digit year numbers, the whole lot could collapse to a single line of code:
strDate=reglement.DateReglement.ToString("ddMMyy");

If interested, maybe read this[^].

4.
And I assume Inserer_Espaces(N) just returns the number of spaces specified, something new string(' ', N) does too.
BTW: are you familiar with string.PadLeft() and string.PadRight()?

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Streamwriter output Pin
Pierre besquent16-Mar-11 0:11
Pierre besquent16-Mar-11 0:11 
GeneralRe: Streamwriter output Pin
Pete O'Hanlon16-Mar-11 0:23
mvePete O'Hanlon16-Mar-11 0:23 
GeneralRe: Streamwriter output Pin
Luc Pattyn16-Mar-11 0:27
sitebuilderLuc Pattyn16-Mar-11 0:27 
GeneralRe: Streamwriter output Pin
Pierre besquent16-Mar-11 3:41
Pierre besquent16-Mar-11 3:41 
Questionbest data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 18:24
shivamkalra15-Mar-11 18:24 
AnswerRe: best data strcuture for numeric parsing. Pin
GlobX15-Mar-11 19:27
GlobX15-Mar-11 19:27 
GeneralRe: best data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 20:22
shivamkalra15-Mar-11 20:22 
GeneralRe: best data strcuture for numeric parsing. Pin
GlobX15-Mar-11 20:32
GlobX15-Mar-11 20:32 
GeneralRe: best data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 20:37
shivamkalra15-Mar-11 20:37 
GeneralRe: best data strcuture for numeric parsing. Pin
GlobX15-Mar-11 20:53
GlobX15-Mar-11 20:53 
GeneralRe: best data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 20:33
shivamkalra15-Mar-11 20:33 
AnswerRe: best data strcuture for numeric parsing. Pin
_Maxxx_15-Mar-11 19:43
professional_Maxxx_15-Mar-11 19:43 
QuestionRe: best data strcuture for numeric parsing. Pin
GlobX15-Mar-11 19:58
GlobX15-Mar-11 19:58 
AnswerRe: best data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 20:23
shivamkalra15-Mar-11 20:23 
GeneralRe: best data strcuture for numeric parsing. Pin
shivamkalra15-Mar-11 20:25
shivamkalra15-Mar-11 20:25 
AnswerRe: best data strcuture for numeric parsing. Pin
PIEBALDconsult16-Mar-11 2:56
mvePIEBALDconsult16-Mar-11 2:56 
AnswerRe: best data strcuture for numeric parsing. Pin
_Erik_16-Mar-11 3:44
_Erik_16-Mar-11 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.