SparK_BR Posted June 14, 2011 Share Posted June 14, 2011 Hi, I'm new here my father (and co-worker) told me to interact with a few communities that it would be good for my professional carreer. However I can't just come here and take whatever I want, so I offer you guys this piece of code. *attached* Sorry for the autodoc comments in portuguese, I'm from Brasil. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/ Share on other sites More sharing options...
ignace Posted June 14, 2011 Share Posted June 14, 2011 However I can't just come here and take whatever I want, so I offer you guys this piece of code. Sure you can, many others do it. Some even go as far as telling us to do THEIR work. Welcome aboard! Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/#findComment-1229606 Share on other sites More sharing options...
SparK_BR Posted June 14, 2011 Author Share Posted June 14, 2011 so uhh... what do you think of the class? useful, unuseful? something I forgot to do? feedback is what keeps me working and don't worry, I don't like to use code people give me. I need to read, understand and then adapt a solution to my problem Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/#findComment-1229731 Share on other sites More sharing options...
per1os Posted June 14, 2011 Share Posted June 14, 2011 The class maybe useful to some, seems decent if you need a lot of string manipulations. Best way to get in on this community, just answer questions, thoroughly and correctly and you will fit in above most. Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/#findComment-1229750 Share on other sites More sharing options...
ignace Posted June 15, 2011 Share Posted June 15, 2011 You do no error-checking like: public function charAt($index){ return new String(substr($this->value,$index,1)); } If I pass in $index >= $str->length() it returns false, resulting in: return new String(false); Not all methods are fully implemented: public function split($delimiter,$limit=false){ $limit = $limit ? $limit : strlen($this->value); $primitive = explode($delimiter,$this->value,$limit); $list = array(); foreach($primitive as $str){ } } Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/#findComment-1229897 Share on other sites More sharing options...
SparK_BR Posted June 16, 2011 Author Share Posted June 16, 2011 Thank you! @the first note: new String(false) is "" it will concat false to the empty value and return empty, which you can eval as false @the second note: now it got fixed I remember trying to use my List class there (the same as using array but as class methods and not language functions) but then I wanted the classes not to depend on eachother and forgot to write the 2 missing lines. *attached new file* ps: for some reason I can't modify the first post to upload the new file there too [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/239355-string-class-for-php/#findComment-1230279 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.