REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: entab

entab  string  /size  number

Converts spaces in a string to tabs (default tab size 4). (Modifies)

Arguments:

string [any-string!]

Refinements:

/size - Specifies the number of spaces per tab

number [integer!]

See also:

detab  

Description

The REBOL language default tab-size is four spaces. Use the /size refinement for other sizes such as eight. entab will only place tabs at the beginning of the line (prior to the first non-space character).

The series passed to this function is modified as a result.

text: {
    no
    tabs
    in
    this
    sentence
} 
remove head remove back tail text
probe text
{    no
    tabs
    in
    this
    sentence}
probe entab copy text
{^-no
   tabs
   in
   this
   sentence}
print entab copy text
        no
   tabs
   in
   this
   sentence
probe entab/size copy text 2
{^-^-no
^- tabs
^- in
^- this
^- sentence}
print entab/size copy text 2
     no
  tabs
  in
  this
  sentence

The opposite function is detab which converts tabs back to spaces:

probe entab text
{^-no
   tabs
   in
   this
   sentence}
probe detab text
{    no
    tabs
    in
    this
    sentence}


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin