Download static/j2s/java/text/MessageFormat.js from patonlab/cascade: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/spaces/patonlab/cascade/resolve/main/static/j2s/java/text/MessageFormat.js
- Command line
-
hf download hf://spaces/patonlab/cascade/static/j2s/java/text/MessageFormat.js
-
curl -L -o MessageFormat.js https://huggingface.co/spaces/patonlab/cascade/resolve/main/static/j2s/java/text/MessageFormat.js
672 Bytes
| Clazz.declarePackage("java.text"); | |
| c$=Clazz.decorateAsClass(function(){ | |
| this.pattern=null; | |
| Clazz.instantialize(this,arguments); | |
| },java.text,"MessageFormat"); | |
| Clazz.makeConstructor(c$, | |
| function(pattern){ | |
| this.pattern=pattern; | |
| },"~S"); | |
| Clazz.makeConstructor(c$, | |
| function(pattern,locale){ | |
| this.pattern=pattern; | |
| },"~S,java.util.Locale"); | |
| c$.format=Clazz.defineMethod(c$,"format", | |
| function(pattern,args){ | |
| return pattern.replace(/\{(\d+)\}/g,function($0,$1){ | |
| var i=parseInt($1); | |
| if(args==null)return null; | |
| return args[i]; | |
| }); | |
| },"~S,~A"); | |
| Clazz.defineMethod(c$,"format", | |
| function(obj){ | |
| return java.text.MessageFormat.format(this.pattern,[obj]); | |
| },"~O"); | |