Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spaces again

Status
Not open for further replies.

INDO

Programmer
Mar 18, 2001
12
US
if I was to use the following code(from a library source)
would the - 1 remove digits from the beginning or the end of the string?.

for(Index = 1; Index <= Length(Line))
if(Line[Index] = 32)
Line[Index] = Line[Index]-1;
Index = Index + 1;

also will the (32) be recognised as a space character?

many thanks
INDO
 
Yes it will but
instead of if(Line[Index] = 32) you should write
if(Line[Index] == 32).

By the way, you don'teliminate spaces. I do not know what character is 31. If you see, line[index]-1 will be 31 if the condition is true.

Look the code bellow, you should follow thieese steps to eliminate anything from strings:
char line[len]=&quot;adsad asdassdgdgh ghfsghyy&quot;;
for(int i=0;i<len;i++)
{
if(line==32)
{
for(int j=i;j<len-1;j++)
{
line[j]=line[j+1];
}
}
} John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top