<?xml version="1.0" encoding = "utf-8"?>

<snippet xmlns:MMString="http://www.macromedia.com/schemes/dat/string/" MMString:name = "Snippets/JavaScript/string_manipulations/wrapString_csn/snippet/name/Wrap" MMString:description = "Snippets/JavaScript/string_manipulations/wrapString_csn/snippet/description/Inserts" preview="code" type="block">


<insertText location="beforeSelection">

<![CDATA[function wrapString(inputString,wrapLength,delimiter)
{
  if (!delimiter) delimiter = '\n';
  if (!wrapLength) wrapLength = inputString.length;
  var buildString = '';

  for (i=0; i < inputString.length; i+=wrapLength)
  {
    buildString += inputString.slice(i,i+wrapLength) + delimiter;
  }

  return buildString.slice(0,(buildString.length - delimiter.length));

}
]]>

</insertText>

<insertText location="afterSelection"><![CDATA[]]>

</insertText>

</snippet>
