|
-
Feb 27th, 2007, 05:28 PM
#1
Thread Starter
New Member
Newbie easy question
I have the following:
strAcctNumber = strAcctNumberWithBank.Substring(2, 9)
What I really want is to grad the account number from position 3 on no matter what the lenght. As you can see now, I am restricted to 9 characters long, and I want it to be where is can be less than or greater than 9, but it must start @ position 3. What the correct syntaxt or best route to accomplish this.
-
Feb 27th, 2007, 05:59 PM
#2
Re: Newbie easy question
That would be
Code:
strAcctNumber = strAcctNumberWithBank.Substring(2, strAcctNumberWithBank.Length - 2)
strAcctNumberWithBank.Length - 2 supplies you with the index of the last char of the string.
-
Feb 27th, 2007, 06:27 PM
#3
Re: Newbie easy question
That would just be:
Code:
strAcctNumber = strAcctNumberWithBank.Substring(2)
You only need the second parameter if you want to stop before the end of the string.
-
Feb 27th, 2007, 07:09 PM
#4
Thread Starter
New Member
Re: Newbie easy question
Appreciate the quick feedback, why is it when I have the following:
strAcctNumberWithBank = Trim(result(0))
strAcctNumber = strAcctNumberWithBank.Substring(2)
I debug and I am not getting an stracctnumber
strAcctNumber Nothing String
strAcctNumberWithBank "98110900016" String
I am expecting strAcctNumber to show '110900016' String
-
Feb 27th, 2007, 07:16 PM
#5
Thread Starter
New Member
Re: Newbie easy question
Nevermind, I think it might be because I was only debugging that one line. Sorry, new to all this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|