Chirantha Posted July 10, 2006 Share Posted July 10, 2006 Hi,I'm a person that is lazy to indent my code.. Then when I find a bug I have a horrible time finding it :(. So I wrote a PHP script that indents code. Well it works to some extent but it isn't perfect.Make sure you use the { and } so it won't mess up. Its a bit high on the CPU. As its still not perfect there will be some bugs. But a basic code can be indented.The script is currently hosted on my Computer. And my computer is online from 12PM - 2AM (+5.5GMT). I don't have a good connection as well :(.This script can make :[code]for (i=0; i<string_length(string1) i+=1) {if (string_char_at(string1,i)="s"){do=1;for (a=0; a<data1; a+=1){stop[i]=1;x=0;y=78;images_angle=4;for (b=d_id; b<d_id+100; b+=1){string_delete(main,1,1)}}}}[/code]To this :[code]for (i=0; i<string_length(string1) i+=1) { if (string_char_at(string1,i)="s") { do=1; for (a=0; a<data1; a+=1) { stop[i]=1; x=0; y=78; images_angle=4; for (b=d_id; b<d_id+100; b+=1) { string_delete(main,1,1) } } }}[/code]Also make sure you code doesn't look like this :[code]if (this) {do thisandthis}[/code][code]if (this) do_this()echo "echo"; [/code]Make sure its like this :[code]if (this) {do thisandthis}[/code][code]if (this) {do_this()}echo "echo"; [/code]link is : http://csoft-p.no-ip.info/string.phpThank you,Chirantha Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/ Share on other sites More sharing options...
.josh Posted July 10, 2006 Share Posted July 10, 2006 just out of curiosity.. if i had to take the trouble to format my script a certain way, in order for it to be converted to another format..why not just type it right in the first place? and personally, i find that properly indenting in the first place helps reduce the bugs you'd be looking for later on. Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-55731 Share on other sites More sharing options...
Chirantha Posted July 10, 2006 Author Share Posted July 10, 2006 well, its impossible to juge the way a script is written. I have done my best to do what I can. I mean its better than nothing :) Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-55796 Share on other sites More sharing options...
effigy Posted July 10, 2006 Share Posted July 10, 2006 Not to frown upon your efforts, but if you're too lazy to indent your code, you shouldn't be coding... Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-55803 Share on other sites More sharing options...
Chirantha Posted July 11, 2006 Author Share Posted July 11, 2006 A year ago I was lazy.. :| but not now much now.. But I wrote this because some programs that I made during the days I didn't indent needed to be indented :) Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-55983 Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Get an editor with auto indention :P Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-56039 Share on other sites More sharing options...
GoinNuts Posted August 16, 2006 Share Posted August 16, 2006 I like it, if for no other reason than it's a good effort at text processing. After all, string manipulation is a big part of what we're all doing... 8) Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-75875 Share on other sites More sharing options...
tomfmason Posted August 16, 2006 Share Posted August 16, 2006 I agree with GoinNuts. You get an A+ for effort. Quote Link to comment https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-75902 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.