Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Tint bitmap behaviour
Face Mouse-Alphamania
A shooting game
MPEG / ActiveMovie ActiveX control
Random Sprite Swap
Director Web
Elapsed Time
myFile
QuickTime Notes
asASIOout
 

 

 

Behavior Triming spaces from string

Added on 6/5/2002

 

Compatibilities:
D7 D8 D8_5 Mac PC Script

This item has not yet been rated

Author: tramsMM

Use this code to trim the spaces present in a string either at the end of the string or at the beginning of the string

-- Use this code to trim the spaces present in a string either at the end of the string
--  or at the beginning of the string

on Ltrim Str
  
  --trims the spaces from the left of the string
  
  repeat while chars(Str,1,1)=" "
    
    set Str=chars(Str,2,length(Str))
    
  end repeat
  
  return Str
  
end
on Rtrim Str
    --trims the spaces from the right of the string
  set i=length(Str)
  
  repeat While chars(Str,i,i)=" "
    set Str=chars(Str,1,i-1)
    set i=length(Str)
  end repeat
  
  return Str
  
end

on TrimBoth Str
  
  Set Str=Ltrim(Str)
  set  Str=Rtrim(Str)
  return Str
  
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail