Ignore:
Timestamp:
Nov 25, 2007, 4:31:35 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Stringなどで例外を投げるようにした。
#147の解決。
CType ASCII文字判定関数群の追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/IO/Path.ab

    r296 r388  
    1010Class Path
    1111Public
    12     Static AltDirectorySeparatorChar = &H2F As Char '/
    13     Static DirectorySeparatorChar = &H5C As Char    '\
    14     Static PathSeparator = &H3B As Char             ';
    15     Static VolumeSeparatorChar = &H3A As Char       ':
     12    Static AltDirectorySeparatorChar = &H2F As StrChar '/
     13    Static DirectorySeparatorChar = &H5C As StrChar    '\
     14    Static PathSeparator = &H3B As StrChar             ';
     15    Static VolumeSeparatorChar = &H3A As StrChar       ':
    1616
    1717    Static Function GetFileName(path As String) As String
     
    121121
    122122    Static Function Combine(path1 As String, path2 As String) As String
    123         If path1.LastIndexOf(Chr$(VolumeSeparatorChar)) And path1.Length = 2 Then
     123        If path1.LastIndexOf(VolumeSeparatorChar) And path1.Length = 2 Then
    124124            Return path1 + path2
    125125        End If
    126126
    127         If path1.LastIndexOf(Chr$(DirectorySeparatorChar), ELM(path1.Length), 1) = -1 Then
     127        If path1.LastIndexOf(DirectorySeparatorChar, ELM(path1.Length), 1) = -1 Then
    128128            Return path1 + Chr$(DirectorySeparatorChar) + path2
    129129        Else
     
    133133
    134134Private
    135     Static Function getExtensionPosition(ByRef path As String) As Long
     135    Static Function getExtensionPosition(path As String) As Long
    136136        Dim lastSepPos = getLastSeparatorPosision(path) As Long
    137         getExtensionPosition = path.LastIndexOf(".", ELM(path.Length), path.Length - lastSepPos)
     137        If lastSepPos = -1 Then
     138            lastSepPos = 0
     139        End If
     140        getExtensionPosition = path.LastIndexOf(Asc("."), ELM(path.Length), path.Length - lastSepPos)
    138141    End Function
    139142
    140     Static Function getLastSeparatorPosision(ByRef path As String) As Long
    141         Dim lastSepPos = path.LastIndexOf(Chr$(DirectorySeparatorChar)) As Long
     143    Static Function getLastSeparatorPosision(path As String) As Long
     144        Dim lastSepPos = path.LastIndexOf(DirectorySeparatorChar) As Long
    142145        If lastSepPos <> -1 Then Return lastSepPos
    143146
    144         lastSepPos = path.LastIndexOf(Chr$(VolumeSeparatorChar))
     147        lastSepPos = path.LastIndexOf(VolumeSeparatorChar)
    145148        Return lastSepPos
    146149    End Function
Note: See TracChangeset for help on using the changeset viewer.