Compare Revisions

StringView

Revision 503561:

Revision 503561 by fusionchess on

Revision 503575:

Revision 503575 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 503561
Revision 503575
n2167var oMyStringView = new StringView("Hello, strange people!"); // n2167var oMyStringView = new StringView("Hello, strange&n
>UTF-8>bsp;people!"); // UTF-8
2168var oMyRegExp = new CLikeRegExp("\\s", "g");2168var oMyRegExp = new CLikeRegExp(" ", "g");
n2170alert(oMyStringView.replace(oMyRegExp, " ")); // "Hello,n2170alert(oMyStringView.replace(oMyRegExp, " ")); // "Hello, strange 
> strange people!">people!\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00
 >00"
t2173alert(oMyStringView); // "Hello, strange peoplet2173alert(oMyStringView); // "Hello, strange people!\u0000\u0000\u000
>!">0\u0000\u0000\u0000\u0000\u0000\u0000\u0000"

Back to History