Thread: Spaces
View Single Post
  #1  
Old 08-28-2007, 05:47 PM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
Spaces

PHP Code:
public function removeAllSpaces(text) {
  
temp.toks text.tokenize();
  for (
temp.str temp.toks) {
    if (
temp.str == " ") {
      continue;
    }
    
temp.out @= temp.str;
  }
  return 
temp.out.trim();
}
//#CLIENTSIDE
public function removeAllSpaces(text) {
  
temp.toks text.tokenize();
  for (
temp.str temp.toks) {
    if (
temp.str == " ") {
      continue;
    }
    
temp.out @= temp.str;
  }
  return 
temp.out.trim();

This removes all spaces everywhere on a join. A simple usage of this would be something like.

PHP Code:
function onCreated() {
  
join("util_spaces");
  
temp.string " Lollin @ Chompy";
  echo(
removeAllSpaces(temp.string));

^ That would echo: "Lollin@Chompy";
Just for some of those minor irritations that are too minor to add a built in function for.
__________________
Stan.
Reply With Quote