Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: what is the function should I need to use for trim white spaces ?

by explorer (Chaplain)
on Jan 11, 2006 at 19:32 UTC ( #522542=note: print w/replies, xml ) Need Help??


in reply to what is the function should I need to use for trim white spaces ?

Yes, you can use functions:
$value=" kkkk.123 "; for ( $i=0; $i<length($value); $i++ ) { if ( substr($value,$i,1) eq " " ) { substr($value,$i,1) = ""; redo; } else { last; } } for ( $i=length($value)-1; $i>0; $i-- ) { if ( substr($value,$i,1) eq " " ) { $value = substr($value,0,$i); } }
but you will like to use the s/// operator, true? :-)
  • Comment on Re: what is the function should I need to use for trim white spaces ?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522542]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2020-06-06 20:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (41 votes). Check out past polls.

    Notices?