CodeIgniter Forums
how to trim input? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: how to trim input? (/showthread.php?tid=38163)



how to trim input? - El Forum - 01-31-2011

[eluser]nuclearmaker[/eluser]
i dont want to use form_validation for trim input.

so i must use native trim function or ci have a slution for that?


how to trim input? - El Forum - 01-31-2011

[eluser]umefarooq[/eluser]
hi its really easy just add trim in rules it will call this function here is example

Code:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');

read documentation

http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html


how to trim input? - El Forum - 02-01-2011

[eluser]Gerep[/eluser]
umefarooq, nuclearmaker doesn't want to use form_validation.


Code:
trim($text);

You haven't searched for on Google right? A simple "trim php" solved the problem. =)


how to trim input? - El Forum - 02-01-2011

[eluser]cideveloper[/eluser]
[quote author="Gerep" date="1296578728"]umefarooq, nuclearmaker doesn't want to use form_validation.


Code:
trim($text);

You haven't searched for on Google right? A simple "trim php" solved the problem. =)[/quote]

Gerep, nuclearmaker already knows about the native trim function. He was asking if CI has a solution for this.

Quote:so i must use native trim function or ci have a slution for that?



how to trim input? - El Forum - 02-01-2011

[eluser]Gerep[/eluser]
cideveloper I got that....but it would be totally unnecessary to create a function like

$this->string->trim($text) if you can simply use trim($text)... =)