[MSH] Use cast or ToString()?



While parsing through a log file and extracting dates from a regex
into $matches.date, I noticed that I could use either of the following
to end up with the numeric day of the month (1..31) as a string :

$day=[string]([datetime]$matches.date).day

or

$day=([datetime]$matches.date).day.tostring()

Is it "Better" to use the cast or the ToString() method? Any views?

Thanks,
Chris
.



Relevant Pages

  • Re: Novice::Help>Split IP Address(port) + count
    ... log file: What is the best combination of 'split' and regexes to do ... But the code you posted starts with opening and reading the file -- ... which is not your stated problem. ... dealing with printing the results of your line parsing to STDOUT -- ...
    (comp.lang.perl.misc)
  • Re: Looping through a log file
    ... > My project is to parse a text log file created by a propietary ... That's the parsing process mentioned above. ... > Event 1 time stamp info ... Is there a need to worry about log entries being written while we are ...
    (comp.lang.perl.misc)
  • Re: help with a regex and greediness
    ... The only place a colon split splits is where you have a colon. ... I am usually extracting information from the ... > tighten the original regex. ... This presumes that you have achild directory named perldoc, ...
    (perl.beginners)
  • Looping through a log file
    ... My project is to parse a text log file created by a propietary ... That's the parsing process mentioned above. ... Event 1 user info ... Event 1 time stamp info ...
    (comp.lang.perl.misc)
  • Re: Hi All,
    ... Parsing a number of web pages and extracting their headings? ... Who could dispense with a user style sheet that displays the h1 content first, ...
    (alt.html)