https://github.com/parser3/als.utils
Utils Component.
https://github.com/parser3/als.utils
als package parser3
Last synced: 5 months ago
JSON representation
Utils Component.
- Host: GitHub
- URL: https://github.com/parser3/als.utils
- Owner: parser3
- License: mit
- Created: 2016-11-22T09:42:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-28T15:54:09.000Z (over 9 years ago)
- Last Synced: 2025-07-24T16:43:44.167Z (11 months ago)
- Topics: als, package, parser3
- Language: OpenEdge ABL
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Als/Utils
Набор классов из пакета [Lib](http://www.parser.ru/lib/lib/).
Включает в себя:
- [Als/Utils/Lib](src/Lib.p)
```ruby
###########################################################################
# cut trailing and leading chars $sChars (whitespaces by default) for $sText
@trim[sText;sChars]
###########################################################################
# print link to $sURI with attributes $uAttr (string or hash) if $sURI specified, otherwise just print $sLabel
@href[sURI;sLabel;uAttr]
###########################################################################
# set location header for redirecting to $sURI and prevent caching
# $.bExternal option makes redirect
@location[sURI;hParam]
###########################################################################
# check email format
@isEmail[sEmail]
###########################################################################
# print $iNum as a binary string
@dec2bin[iNum;iLength]
###########################################################################
# makes hash of tables from $tData. if $sKeyColumn is not specified 'parent_id' will be used
@createTreeHash[tData;sKeyColumn]
###########################################################################
# print number. options $.iFracLength, $.sThousandDivider and $.sDecimalDivider are available
@numberFormat[dNumber;hParam]
###########################################################################
# looks over hash elements in specified order
@foreach[hHash;sKeyName;sValueName;jCode;sSeparator;sDirection]
###########################################################################
# returns hash with parser version
@getParserVersion[]
###########################################################################
# every odd call returns $sColor1, every even - $sColor2, without parameters - reset sequence
@color[sColor1;sColor2]
###########################################################################
# creates 2-levels hash
@create2LevelHash[uData;sField1;sField2]
```
- [Als/Utils/Doc](src/Doc.p)
```ruby
###########################################################################
# print $xDoc as string without DOCTYPE and XML declaration
@toString[xDoc]
```
- [Als/Utils/Node](src/Node.p)
```ruby
############################################################
# print $xNode as string
@toString[xNode;sRootTag]
############################################################
# print $xNode VALUE as string: ccc => "ccc"
@valueToString[xNode;sRootTag]
############################################################
# go through all nodes in $hNodeList and execute $jCode
@foreach[hNodeList;hNodeName;sNode;sAttr;jCode;sSeparator]
############################################################
# go through all children for $xParent and execute $jCode
@foreachChild[xParent;hNodeName;sNode;sAttr;jCode;sSeparator]
############################################################
# get children of $xParent as hash
@getChildren[xParent;hNodeName]
```
- [Als/Utils/Attrs](src/Attrs.p)
- [Als/Utils/Cached](src/Cached.p)
- [Als/Utils/Convert](src/Convert.p)
- [Als/Utils/Logger](src/Logger.p)
- [Als/Utils/LibComp](src/LibComp.p)
---
## Installation
```bash
$ composer require als/utils
```
---
## References
- Bugs and feature request are tracked on [GitHub](https://github.com/parser3/als.utils/issues)