Changeset 526


Ignore:
Timestamp:
Jun 26, 2008, 8:25:29 PM (16 years ago)
Author:
OverTaker
Message:

List,TimeSpan.ToString()実装。
Console.WriteのObject型のオーバーロードを追加。

Location:
trunk/ab5.0/ablib/src/Classes/System
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/List.ab

    r519 r526  
    156156
    157157    /*!
     158    @brief  Listの要素を文字列で返す
     159    @author OverTaker
     160    @date   2008/6/26
     161    @return 文字列
     162    */
     163    Override Function ToString() As String
     164        Dim object As Object
     165        Dim s As String
     166        Foreach object In This
     167            s += object.ToString() + Ex"\r\n"
     168        Next
     169        Return s
     170    End Function
     171
     172    /*!
    158173    @brief  IEnumeratorインターフェイスを取得する
    159174    @author Daisuke Yamamoto
  • trunk/ab5.0/ablib/src/Classes/System/Console.ab

    r522 r526  
    146146    Static Sub Write(x As Int64)
    147147        Write(Str$(x))
     148    End Sub
     149
     150    Static Sub Write(x As Object)
     151        Write(x.ToString)
    148152    End Sub
    149153
  • trunk/ab5.0/ablib/src/Classes/System/TimeSpan.ab

    r275 r526  
    164164        End If
    165165    End Function
     166
     167    Override Function ToString() As String
     168        If Ticks < 0 Then
     169            Dim span = Negate() As TimeSpan
     170            Return ActiveBasic.Strings.SPrintf("-%d:%.2d:%.2d:%.2d.%.4d",
     171                New Int32(span.Days) ,New Int32(span.Hours), New Int32(span.Minutes), New Int32(span.Seconds), New Int32(span.Milliseconds))
     172        Else
     173            Return ActiveBasic.Strings.SPrintf("%d:%.2d:%.2d:%.2d.%.4d",
     174                New Int32(Days) ,New Int32(Hours), New Int32(Minutes), New Int32(Seconds), New Int32(Milliseconds))
     175        End If
     176    End Function
    166177   
    167178    Static Function FromTicks(ticks As Int64) As TimeSpan
Note: See TracChangeset for help on using the changeset viewer.