Posts

Showing posts from November 9, 2009

StringList class and use of it

This class can be used to manage lists of strings. It can take a list of strings separated by line breaks and extracts key value pairs separated by the = character.The class can return the list of strings as an array, add more strings to the list, and save or load the list from a file. stringlist_class.php class StringList{ private $Values=array(); private $Text; private $Lines=array(); /** * It's constructor func * * @param mixed $string String you want parse. * @return StringList */ public function StringList($string){ $this->Text=$string; $this->Lines=explode("\n",$string); $Count=count($this->Lines); Foreach ($this->Lines As $LineText){ $EsitPos=strpos($LineText,'='); $this->Values[substr($LineText,0,$EsitPos)]=substr($LineText,$EsitPos+1,strlen($LineText)); } return $this; } /** * Return The Text Or Set Text (ReCreate Object). * * @param mixed $SetTex it will change if it