mozilla

Compare Revisions

StringView

Change Revisions

Revision 503557:

Revision 503557 by fusionchess on

Revision 503559:

Revision 503559 by fusionchess on

Title:
StringView
StringView
Slug:
Code_snippets/StringView
Code_snippets/StringView
Tags:
"Code snippet", "MDN JavaScript Libraries", "Sample code", "Guide", "js-ctypes", "WebGL", "JavaScript typed arrays", "JavaScript", "Typed Arrays", "WebSockets"
"Code snippet", "MDN JavaScript Libraries", "Sample code", "Guide", "js-ctypes", "WebGL", "JavaScript typed arrays", "JavaScript", "Typed Arrays", "WebSockets"
Content:

Revision 503557
Revision 503559
n2098      Let's compile this C program:n2098      Let's compile this <a href="http://en.wikipedia.org/wiki/C_
 >%28programming_language%29">C</a> program:
n2189      <li id="note_about_length">If you want to create a <code>stn2189      <li id="note_about_length">If you want to create a <code>st
>ringView</code> inside a <em>bigger</em> empty buffer, like in th>ringView</code> inside a <em>bigger</em> empty buffer, like in th
>e following <strong><a href="http://en.wikipedia.org/wiki/C_%28pr>e following <a href="http://en.wikipedia.org/wiki/C_%28programmin
>ogramming_language%29">C</a></strong> line>g_language%29">C</a> line
n2195var mySW = new StringView("Hello world!");n
nn2197var myContent = new StringView("Hello world!");
2198myBuffer.rawData.set(mySW.rawData, mySW.rawData.length);2198myBuffer.rawData.set(myContent.rawData, myContent.rawData.length)
 >;
tt2203      </li>
2204      <li>Since <code>stringView</code>, unlike <a href="http://e
 >n.wikipedia.org/wiki/C_%28programming_language%29">C</a> strings,
 > has a <code>length</code> property, there are no reasons to add 
 >a null character (<code>'\0'</code>) after the termination of the
 > string.

Back to History