Connecting Tech Pros Worldwide Help | Site Map

Removing Apart Of String

Member
 
Join Date: Mar 2008
Posts: 32
#1: May 6 '08
Hi a simple questin in got is whythe remove thing doesent always work
if your starting integer is 0 and ending integer is like 10 its fine
Expand|Select|Wrap|Line Numbers
  1.  
  2. string =  textbox1.text.remove(0,10)
  3.  
  4.  
but if your starting integer is like 47 and last is 57 it wont work. WHY. Could somebody please help me withit
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,500
#2: May 6 '08

re: Removing Apart Of String


just check all the over loaded Remove methods with their parameters , you will come to know the simple answer.
lotus18's Avatar
Site Addict
 
Join Date: Nov 2007
Location: Zamboanga City, Philippines
Posts: 856
#3: May 7 '08

re: Removing Apart Of String


Quote:

Originally Posted by BarryM

Hi a simple questin in got is whythe remove thing doesent always work
if your starting integer is 0 and ending integer is like 10 its fine

Expand|Select|Wrap|Line Numbers
  1.  
  2. string =  textbox1.text.remove(0,10)
  3.  
  4.  
but if your starting integer is like 47 and last is 57 it wont work. WHY. Could somebody please help me withit

Hi

Expand|Select|Wrap|Line Numbers
  1.  string =  textbox1.text.remove(0,10)
  2.  
This means that 0 is your starting index to remove the characters and 10 is the length or the number of characters to be deleted.

Rey Sean
Newbie
 
Join Date: Dec 2006
Posts: 20
#4: May 8 '08

re: Removing Apart Of String


you probably got it already from the replies above, whatever, your code will look like this
Expand|Select|Wrap|Line Numbers
  1. string=textbox1.text.remove(47,10)
  2.  
I presume you wanted to remove char.s with indices 47-57
the problem you're facing is caused by either the length of your textbox1.text is not 104(47+57) or even if it is, you're removing char.s with indices 47-104
Reply