2022-04-27 01:29:21 -04:00

74 lines
2.7 KiB

<!DOCTYPE html>
<!-- printj.js (C) 2016-present SheetJS -->
<!-- vim: set ts=2: -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PRINTJ Live Demo</title>
table, td {
border: 1px dotted black;
text-align: left;
<b>PRINTJ Live Demo</b><br />
<a href="">Source Code Repo</a><br />
<a href="">Issues? Something look weird? Click here and report an issue</a><br />
<br />
usage: var printf = PRINTJ.sprintf;
This implementation supports the full POSIX set of conversions. Consult the enclosed README for full details.
<div><a href="">POSIX documentation</a></div><br />
<table id="data">
<script type="text/javascript">/* jshint browser:true, evil:true */</script>
<script src="shim.js"></script>
<script src=""></script>
<script src="printj.js"></script>
<script type="text/javascript">
/* eslint-env browser */
/*global PRINTJ */
var table = document.getElementById("data");
var ex = [
'printf("|Hello %s|", "SheetJS")',
'printf("|%1$d %1$o %1$u %1$x %1$X|", 1234)',
'printf("|%1$d %1$o %1$u %1$x %1$X|", -1234)',
'printf("|%1$d %1$o %1$u %1$x %1$X %1$lld|", 2813308004)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", 1.2)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", Math.PI)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", Math.LOG2E)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", -Math.LOG10E)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", Infinity)',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", -0)',
'printf("|%012s|", "SheetJS")',
'printf("|%-12s|", "SheetJS")',
'printf("|%1$f %1$F %1$e %1$E %1$g %1$G %1$a %1$A|", 1.4142E69)',
window.onload = function() {
var printf = PRINTJ.sprintf;
printf("Hello %s", "world");
ex.forEach(function(m) {
var row = table.insertRow(table.rows.length);
var c1 = row.insertCell(0); c1.innerHTML = "<pre>" + m + "</pre>";
var c2 = row.insertCell(1); c2.innerHTML = "<pre>" + eval(m) + "</pre>";
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);