[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System String.cs,1.25,1.26
From: |
Jonathan Springer <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System String.cs,1.25,1.26 |
Date: |
Mon, 11 Nov 2002 17:37:45 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv14369/runtime/System
Modified Files:
String.cs
Log Message:
String clean-up: execeptions and LastIndexOf*
Index: String.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/String.cs,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** String.cs 16 Sep 2002 19:11:58 -0000 1.25
--- String.cs 11 Nov 2002 22:37:43 -0000 1.26
***************
*** 541,544 ****
--- 541,549 ----
public override bool Equals(Object obj)
{
+ if(this == null)
+ {
+ throw new NullReferenceException();
+ }
+
if(obj is String)
{
***************
*** 556,563 ****
// Determine if this string is the same as another.
! public bool Equals(String value)
! {
! return Equals(this, value);
! }
// Format a single-argument string.
--- 561,568 ----
// Determine if this string is the same as another.
! //public bool Equals(String value)
! // {
! // return Equals(this, value);
! // }
// Format a single-argument string.
***************
*** 984,987 ****
--- 989,997 ----
public int LastIndexOf(char value, int startIndex)
{
+ if (startIndex > length)
+ {
+ throw new ArgumentOutOfRangeException(
+ "startIndex",
_("ArgRange_StringIndex"));
+ }
return LastIndexOf(value, startIndex,
startIndex + 1);
}
***************
*** 996,1009 ****
public int LastIndexOf(String value, int startIndex)
{
return LastIndexOf(value, startIndex,
startIndex + 1);
}
public int LastIndexOf(String value, int startIndex, int count)
{
- int posn;
if(value == null)
{
throw new
ArgumentNullException("value");
}
! if(startIndex < 0 || startIndex >= length)
{
throw new ArgumentOutOfRangeException
--- 1006,1023 ----
public int LastIndexOf(String value, int startIndex)
{
+ if (startIndex >= length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("startIndex",
_("ArgRange_StringIndex"));
+ }
return LastIndexOf(value, startIndex,
startIndex + 1);
}
public int LastIndexOf(String value, int startIndex, int count)
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
! if(startIndex < 0)
{
throw new ArgumentOutOfRangeException
***************
*** 1015,1029 ****
("count",
_("ArgRange_StringRange"));
}
! posn = FindInRange
(startIndex - value.Length + 1,
startIndex - count + 1, -1, value);
- if(posn != -1)
- {
- return posn + value.Length - 1;
- }
- else
- {
- return -1;
- }
}
--- 1029,1038 ----
("count",
_("ArgRange_StringRange"));
}
!
! if (value.length == 0) return 0;
!
! return FindInRange
(startIndex - value.Length + 1,
startIndex - count + 1, -1, value);
}
***************
*** 1035,1038 ****
--- 1044,1052 ----
public int LastIndexOfAny(char[] anyOf, int startIndex)
{
+ if (startIndex >= length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("startIndex",
_("ArgRange_StringIndex"));
+ }
return LastIndexOfAny(anyOf, startIndex,
startIndex + 1);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System String.cs,1.25,1.26,
Jonathan Springer <address@hidden> <=