Blockland Forums > Modification Help

Removing all tags

Pages: << < (3/4) > >>

Chrono:


--- Quote from: Brian Smithers on March 02, 2012, 06:49:46 PM ---getSubStr(string,start,end) - Used to get a section of a string. Start and End are integers.

EDIT: Crashed me.

--- End quote ---
Nope.

getSubStr(string,start,length)

phflack:


--- Quote from: Jardev on March 02, 2012, 07:42:40 PM ---Shouldn't

--- Code: ---   %newstr = %string;
--- End code ---
Go inside the while() statement?

--- End quote ---
no, then it'd reset each time

--- Quote from: Chrono on March 02, 2012, 07:42:46 PM ---Nope.

getSubStr(string,start,length)

--- End quote ---
so then...

--- Code: ---function findNextTag(%string)
{
   %start = strPos(%string,"<");
   %end = strPos(%string,">");
   return %start SPC %end;
}
function removeTags(%string)
{
   %newstr = %string;
   while(findNextTag(%newstr) !$= "-1 -1")
   {
      %tagpos = findNextTag(%string);
      %start = getWord(%tagpos,0);
      %end = getWord(%tagpos,1);
      %sut = getSubStr(%string,0,%start);
      %eut = getSubStr(%string,%end,strLen(%string) - 1 - %end);
      %newstr = %sut @ %eut;
   }
   return %newstr;
}

--- End code ---


Brian Smithers:


--- Quote from: phflack on March 02, 2012, 08:00:35 PM ---no, then it'd reset each timeso then...

--- Code: ---function findNextTag(%string)
{
   %start = strPos(%string,"<");
   %end = strPos(%string,">");
   return %start SPC %end;
}
function removeTags(%string)
{
   %newstr = %string;
   while(findNextTag(%newstr) !$= "-1 -1")
   {
      %tagpos = findNextTag(%string);
      %start = getWord(%tagpos,0);
      %end = getWord(%tagpos,1);
      %sut = getSubStr(%string,0,%start);
      %eut = getSubStr(%string,%end,strLen(%string) - 1 - %end);
      %newstr = %sut @ %eut;
   }
   return %newstr;
}

--- End code ---

--- End quote ---
did you test this?

otto-san:

stripColorCodes( stringtoStrip )
stripMLControlChars( sourceString )

do those not work

Brian Smithers:


--- Quote from: otto-san on March 02, 2012, 09:14:03 PM ---stripColorCodes( stringtoStrip )
stripMLControlChars( sourceString )

do those not work

--- End quote ---
Do those take out every single tag.

Pages: << < (3/4) > >>

Go to full version