Cook Spaces



Browsers vary in how well they handle tabs in html forms so we offer to ConvertSpacesToTabs. Here we replace spans of three or more spaces in the input text with ascii tab characters, so long as convert has been requested for the posting.

  sub CookSpaces {
    $CookedInput{text} =~ s/ {3,8}/\t/g
      if $CookedInput{convert};
  }

We nibble at long spans of spaces converting eight spaces at a time. 3 to 8 spaces makes one tab; 9 to 16 spaces makes two tabs; and so on.

 

Last edited July 24, 2001
Return to WelcomeVisitors