Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arthur-debert/printf-as3
A printf like facility for Actionscript, loosely inspired by Python's.
https://github.com/arthur-debert/printf-as3
Last synced: about 2 months ago
JSON representation
A printf like facility for Actionscript, loosely inspired by Python's.
- Host: GitHub
- URL: https://github.com/arthur-debert/printf-as3
- Owner: arthur-debert
- License: mit
- Created: 2010-10-15T16:49:10.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-10-11T03:13:16.000Z (over 12 years ago)
- Last Synced: 2024-08-04T05:05:04.755Z (5 months ago)
- Language: ActionScript
- Homepage: http://www.stimuli.com.br/trane/2009/feb/21/printf-as3/
- Size: 5.24 MB
- Stars: 49
- Watchers: 7
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actionscript-sorted - printf-as3 - A printf like facility for Actionscript, loosely inspired by Python's. (Unsorted / Other API)
README
# printf-as3
Function for doing string variable substitutions in AS3.
Inspired by python's print and strtime.### Usage
import br.com.stimuli.string.printf;
// objects are substitued in the other they appearprintf("This is an %s library for creating %s", "Actioscript 3.0", "strings");
// outputs: "This is an Actioscript 3.0 lybrary for creating strings";
// you can also format numbers:printf("You can also display numbers like PI: %f, and format them to a fixed precision, such as PI with 3 decimal places %.3f", Math.PI, Math.PI);
// outputs: " You can also display numbers like PI: 3.141592653589793, and format them to a fixed precision, such as PI with 3 decimal places 3.142"
// Instead of positional (the order of arguments to print f, you can also use propertie of an object):
var userInfo : Object = {
"name": "Arthur Debert",
"email": "[email protected]",
"website":"http://www.stimuli.com.br/",
"ocupation": "developer"
}printf("My name is %(name)s and I am a %(ocupation)s. You can read more on my personal %(website)s, or reach me through my %(email)s", userInfo);
// outputs: "My name is Arthur Debert and I am a developer. You can read more on my personal http://www.stimuli.com.br/, or reach me through my [email protected]"
// you can also use date parts:
var date : Date = new Date();
printf("Today is %d/%m/%Y", date, date, date);For more examples, see the test suit in [test-proj/src][tests]...
### License
[MIT][mit] licensed.[arthur-debert]:http://www.stimuli.com.br
[mit]:http://mit-license.org
[tests]:./printf-as3/tree/master/test-proj/src