- Timestamp:
- May 30, 2008, 10:23:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/basic/function.sbp
r497 r514 314 314 Dim i As Long, i2 As Long, i3 As Long 315 315 316 Dim len1 = buf1.Length 317 Dim len2 = buf2.Length 318 319 If len2=0 Then 320 InStr=StartPos 316 Dim len1 = 0 As Long 317 Dim len2 = 0 As Long 318 If Not ActiveBasic.IsNothing(buf1) Then len1 = buf1.Length 319 If Not ActiveBasic.IsNothing(buf2) Then len2 = buf2.Length 320 321 If len2 = 0 Then 322 InStr = StartPos 321 323 Exit Function 322 324 End If 323 325 324 326 StartPos-- 325 If StartPos <0 Then327 If StartPos < 0 Then 326 328 'error 327 InStr =0329 InStr = 0 328 330 Exit Function 329 331 End If … … 348 350 349 351 Function Left$(s As String, length As Long) As String 350 Left$ = s.Substring(0, System.Math.Min(s.Length, length)) 352 If Not ActiveBasic.IsNothing(s) Then 353 Left$ = s.Substring(0, System.Math.Min(s.Length, length)) 354 Else 355 Left$ = "" 356 End If 351 357 End Function 352 358 353 359 Function Mid$(s As String, startPos As Long) As String 354 startPos-- 355 Mid$ = s.Substring(startPos) 360 If Not ActiveBasic.IsNothing(s) Then 361 startPos-- 362 Mid$ = s.Substring(startPos) 363 Else 364 Mid$ = "" 365 End If 356 366 End Function 357 367 358 368 Function Mid$(s As String, startPos As Long, readLength = 0 As Long) As String 359 startPos-- 360 Dim length = s.Length 361 Mid$ = s.Substring(System.Math.Min(startPos, length), System.Math.Min(readLength, length - startPos)) 369 If Not ActiveBasic.IsNothing(s) Then 370 startPos-- 371 Dim length = s.Length 372 Mid$ = s.Substring(System.Math.Min(startPos, length), System.Math.Min(readLength, length - startPos)) 373 Else 374 Mid$ = "" 375 End If 362 376 End Function 363 377 … … 373 387 374 388 Function Right$(s As String, length As Long) As String 375 Right$ = s.Substring(System.Math.Max(0, s.Length - length), s.Length) 389 If Not ActiveBasic.IsNothing(s) Then 390 Right$ = s.Substring(System.Math.Max(0, s.Length - length), s.Length) 391 Else 392 Right$ = "" 393 End If 376 394 End Function 377 395 … … 627 645 628 646 Function Val(buf As *Char) As Double 647 If buf = 0 Then 648 Exit Function 649 End If 650 629 651 Dim i As Long, i2 As Long, i3 As Long, i4 As Long 630 652 Dim temporary As String
Note:
See TracChangeset
for help on using the changeset viewer.