Substring explanation

RickyUser6

Member
Joined
Jan 27, 2006
Messages
7
Programming Experience
1-3
Hello, there are this 2 lines of codes

VB.NET:
[SIZE=2]strPartyAbbrev = [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](alsData(i)).Substring(intStringLength - 2, 1)
alsData(i) = [/SIZE][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][SIZE=2](alsData(i)).Substring(0, intStringLength - 4)
[/SIZE]

strPartyAbbrev is indicating that it will get the last character of the string right?

but im stuck on what alsData(i) does on the next line....that (0, intStringLength -4) is hurting my brain lol
 
Assume for the sake of argument that intStringLength = 10.
In the first line, 10 - 2 = 8, so the substring returned will be
the eighth character. (Starting position of substring = 8,
length of substring = 1).
In the second line, the substring begins at 0, and 10 - 4 = 6 for
the length of substring, so "alsData(i)" is being shortened to
its first six characters.
The help topic on substring explains this.
BTW, if I'm wrong, I know someone with more smarts will correct this.
 
Back
Top