git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
faf7e12
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
source
helpers
string.ts
[mov] server
Christian Fraß
commited
faf7e12
at 2021-03-08 23:05:42
string.ts
Blame
History
Raw
namespace helpers.string { /** */ export function coin ( template : string, arguments_ : {[key : string] : string}, open : string = "{{", close : string = "}}" ) : string { let result : string = template; for (let [key, value] of Object.entries(arguments_)) { const pattern : string = (open + key + close); result = result.replace(new RegExp(pattern, "g"), value); } return result; } export function pad_left ( subject : string, length : int, filler : string ) : string { let result : string = subject; while (result.length < length) { result = (filler + result); } return result; } }