forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with strdel please

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Sun Apr 11, 2004 9:01 am    Post subject: Help with strdel please Reply with quote

I have written this code to remove comment lines and comments from the end of strings. but its only removing full lines and that the comments after the text.

a comment always starts with #

Code:

:Remove Commentsmenu
  list create,1
  list seek,list1,0
 
  repeat
 
  if @equal(@pos(#,@item(list1)),1)
    list delete,list1
  else
    %%POSFIND = @pos(#,@item(list1))
   %%LEN = @len(@item(list1))
   if @equal(%%POSFIND,0)
      list add,1,@item(list1)
     list delete,list1
   else
     %%NEWITEM = @item(list1)
     %%STRDEL = @strdel(%%NEWITEM,%%POSFIND,%%LEN)
     list add,1,%%NEWITEM
     list delete,list1
   end
  end
 
  until @equal(@count(list1),0)
 
  list clear,list1,
  list assign,list1,1
  list close,1
  goto evloop


What is wrong with my strdel?
Thank you
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Apr 11, 2004 11:58 am    Post subject: Reply with quote

I don't have time to throughly investigate the code, but you can also
delete beginning from the end of the string by using something like:

Code:
%a = @strdel(%a,5,-2)

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 8:20 pm    Post subject: Reply with quote

I was thinking the pos # might not be legal, maybe replace the # with a number..
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Apr 11, 2004 9:00 pm    Post subject: Reply with quote

"#" is what is trying to be found, so it would be indeed a legal character.
You could try putting it in quotes, but I don't think that will really help.

Are you sure you're managing your list right? Are the comments whole-line
comments? If not, then you shouldn't be deleting the whole list item.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 9:21 pm    Post subject: Reply with quote

I was in a rush when I posted that.
Sorry about that Embarassed
I should have refreshed my self with the @POS before I tryed to help, my mistake Wink
Back to top
View user's profile Send private message Visit poster's website
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Mon Apr 12, 2004 9:26 am    Post subject: Reply with quote

Never mind i fixed it.

Thanks anyway
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group