About: Pad the Left or Right of a String   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

This pair of functions allow you to pad a string (or number) to a given length with a specified character. This might be useful in situations where you need to pad a number with leading zeroes for example. Usage:

AttributesValues
rdfs:label
  • Pad the Left or Right of a String
rdfs:comment
  • This pair of functions allow you to pad a string (or number) to a given length with a specified character. This might be useful in situations where you need to pad a number with leading zeroes for example. Usage:
dcterms:subject
abstract
  • This pair of functions allow you to pad a string (or number) to a given length with a specified character. This might be useful in situations where you need to pad a number with leading zeroes for example. Usage: padLeft(24, 5, '0') // Returns '00024' padRight('Foo', 10, 'b') // Returns 'Foobbbbbbb' function padLeft(val, len, repChar) { var strReturn = val.toString(); var x; for (x = 1; x <= num - val.toString().length; x++) { strReturn = repChar.toString() + strReturn; } return strReturn; } function padRight(val, len, repChar) { var strReturn = val.toString(); var x; for (x = 1; x <= len - val.toString().length; x++) { strReturn += repChar.toString(); } return strReturn; }
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software