{"id":18991404,"url":"https://github.com/aziascreations/pb-utils","last_synced_at":"2026-02-26T08:46:25.727Z","repository":{"id":100760369,"uuid":"107832018","full_name":"aziascreations/PB-Utils","owner":"aziascreations","description":"A collection of small independent includes for your PureBasic programs that aim to provided some missing and important functionalities.","archived":false,"fork":false,"pushed_at":"2021-12-30T23:50:51.000Z","size":147,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-21T11:20:27.564Z","etag":null,"topics":["endianness","purebasic","utilities","uuid"],"latest_commit_sha":null,"homepage":"","language":"PureBasic","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aziascreations.png","metadata":{"files":{"readme":"readme-legacy.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-22T02:41:24.000Z","updated_at":"2024-08-31T04:42:34.000Z","dependencies_parsed_at":"2023-06-09T16:15:12.179Z","dependency_job_id":null,"html_url":"https://github.com/aziascreations/PB-Utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aziascreations/PB-Utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aziascreations%2FPB-Utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aziascreations%2FPB-Utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aziascreations%2FPB-Utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aziascreations%2FPB-Utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aziascreations","download_url":"https://codeload.github.com/aziascreations/PB-Utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aziascreations%2FPB-Utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29854560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["endianness","purebasic","utilities","uuid"],"created_at":"2024-11-08T17:13:46.985Z","updated_at":"2026-02-26T08:46:25.702Z","avatar_url":"https://github.com/aziascreations.png","language":"PureBasic","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Purebasic Utils\nThis repository contains a small collection of utilities designed to help you with specific tasks in PureBasic.\n\n# This readme is out of date, please read the source code for the doc in the comments.\n\nThis repo is mostly a collection of small procdeures that can help in projects.\n\n\n# Purebasic Utils\nA small collection of utilities designed to help you in [programming in PB ?].\u003cbr\u003e\n\n**Disclaimer:**\u003cbr\u003e\nSome procedures are based on other people's code.\u003cbr\u003e\nFor each of them, credit is given in the source code files and in the [Credits](#credits) section.\u003cbr\u003e\nAnd a url linking to the original thread or post is also given.\n\n\nEvery source code should work with EnableExplicit.\n\n**Available utilities:**\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;● [Logger](#logger)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;● [Semantic Versioning](#semantic-versioning)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;● [Strings](#strings)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;⚬ [ExplodeStringToArray()](#user-content-strings.explodestringtoarray)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;⚬ [IsNullOrEmpty()](#user-content-strings.isnullorempty)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;⚬ [Format()](#user-content-strings.format)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;● [Unit Testing](#unit-testing-basic)\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;● [UUID4](#uuid4-logger-version--lite-version)\n\n## Utilities\n### [Logger](Logger.pb)\n\n\u003ca name=\"logger.tmp\"\u003e\u003c/a\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eClick to expand\u003c/code\u003e\u003c/summary\u003e\n\u003cb\u003e!!! A large portion of the formatter will be reworked when the Strings.Format() procedure is finished. !!!\u003c/b\u003e\n\nThis utility lets you easily log things to the console, debug window, or to a log file.\n\n#### ◆ **Log file configuration**\n`ConfigureLoggerOutputPath(LogFilePath.s=\"\", KeepPreviousIfError.b=#True)`\u003cbr\u003e\n[*]An empty string will disable the log file and ...\n\n#### ◆ **Logging levels configuration**\n`ConfigureLogLevels(LogFileLoggingLevel.b=..., DebugWindowLoggingLevel.b=..., ConsoleLoggingLevel.b=...)`\u003cbr\u003e\n\nThese 3 procedures allow you to configure each level independently:\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureFileLogLevel(LogFileLoggingLevel.b)`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureDebugWindowLogLevel(DebugWindowLoggingLevel.b)`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureConsoleLogLevel(ConsoleLoggingLevel.b)`\u003cbr\u003e\n\nAvailable logging levels:\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Trace` - \"Super-debug\" level\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Debug` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Fatal` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Error` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Warn` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Info` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Off` - \u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Any` - Everything except the Trave level.\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`#LoggingLevel_Keep` - Only used internally or with `ConfigureLogFormats(...)`.\n\n#### ◆ **Logging formats configuration**\n\n`ConfigureLogFormats(TimeFormat.s=\"\", DebugWindowLoggingFormat.s=\"\", LogFileLoggingFormat.s=\"\", ConsoleLoggingFormat.s=\"\")`\u003cbr\u003e\nThis procedure will \n\nThese 4 procedure allow you to configure each format independently:\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureTimeLogFormat(TimeFormat.s)`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureDebugWindowLogFormat(DebugWindowLoggingFormat.s)`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureFileLogFormat(LogFileLoggingFormat.s)`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`ConfigureConsoleLogFormat(ConsoleLoggingFormat.s)`\n\nThe following [?] can be used in the format String:\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● `%time%` will be replaced by the formatted time (`TimeFormat.s`).\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● `%msg%` will be replaced by the message (`Message.s`).\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● `%mbtitle%` will be replaced by the MessageBox title (`MBTitle.s`).\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● `%mbmsg%` will be replaced by the MessageBox message (`MBMessage.s`).\u003cbr\u003e\n\nDefault formats:\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● File: `\"%time% - %msg%\"`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● Time: `\"%yy-%mm-%dd %hh:%ii:%ss\"`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● Debug: `\"%msg%\"`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;● Console: `\"%msg%\"`\n\n#### ◆ **Usage**\n\u003cbr\u003e\n\u003c/details\u003e\u003cbr\u003e\n\n\n### [Semantic Versioning](SemanticVersioning.pb)\n\n\u003ccode\u003eInitializeSemVer(CanShowMessages.b=#False, CanEndProgram.b=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eIsVersionValid(Version.s, DoValidityCheck=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eGetVersionNumber(Version.s, CanShowMessages.b=#False, CanEndProgram.b=#True, DoValidityCheck=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eGetVersionMajor(Version.s, CanShowMessages.b=#False, CanEndProgram.b=#True, DoValidityCheck=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eGetVersionMinor(Version.s, CanShowMessages.b=#False, CanEndProgram.b=#True, DoValidityCheck=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eGetVersionPatch(Version.s, CanShowMessages.b=#False, CanEndProgram.b=#True, DoValidityCheck=#True)\u003c/code\u003e\u003cbr\u003e\n\n\u003ccode\u003eIsVersionCompatible(VersionA.s, VersionB.s)\u003c/code\u003e\n\n\u003cbr\u003e\n\n\n### [Strings](Strings.pb)\n\n\u003ca name=\"strings.explodestringtoarray\"\u003e\u003c/a\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eExplodeStringToArray(Array a$(1), s$, d$)\u003c/code\u003e\u003c/summary\u003e\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eHow it works:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Explodes a given String(s$) at every given delimiter(d$) and stores the String parts in a given pre-initialized Array(a$).\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eReturns :\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The number of occurences/sections in the given String.\u003c/p\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Or the amount of entries in the array.\u003c/p\u003e\n\u003c/details\u003e\u003cbr\u003e\n\n\u003ca name=\"strings.isnullorempty\"\u003e\u003c/a\u003e\n\u003cdetails\u003e\n\t\u003csummary\u003e\u003ccode\u003eIsNullOrEmpty(a$)\u003c/code\u003e\u003c/summary\u003e\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eParameters:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;a$ - A String that will be analysed.\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eReturns :\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;A nonzero value if \u003ci\u003ea$\u003c/i\u003e is equal to \u003ci\u003e#Null$\u003c/i\u003e, of length 0 or if it is filled with spaces characters (0x20).\u003c/p\u003e\n\u003c/details\u003e\u003cbr\u003e\n\n\u003ca name=\"strings.format\"\u003e\u003c/a\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eFormat(text.s, *val1=0, ..., *val11=0)\u003c/code\u003e\u003c/summary\u003e\n\u003cb\u003eTEMP: This function isn't finished!\u003c/b\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eHow it works:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;???\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eParameters:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;text.s - ???\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;*val1 - ???\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;*val11 - ???\u003cbr\u003e\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eFormatting:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;???\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u0026nbsp;\u003cb\u003eReturns:\u003c/b\u003e\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The formatted String\u003c/p\u003e\n\u003c/details\u003e\u003cbr\u003e\n\n\u003cbr\u003e\n\n\n### [Unit Testing](UnitTest-Basic.pb) (Basic)\nThis basic unit testing [module ???] utility gives you access to the following procedures and values:\n\n\u003cb\u003eProcedures:\u003c/b\u003e\u003cbr\u003e\n`Assert(Bool.b, TestName.s=\"\")`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;If `Bool.b` is true, the value of `PassedTests.i` will be incremented, otherwise, `FailedTests.i` will be.\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;A condition can be passed as `Bool.b` if it is \"wrapped\" in a `Bool()` procedure.\n\n`AssertTrue(Bool.b=#True, TestName.s=\"\")`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Same as `Assert()`, with a default value for `Bool.b`.\n\n`AssertFalse(Bool.b=#False, TestName.s=\"\")`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;The opposite of `AssertTrue()`.\n\n`Pass(TestName.s=\"\")`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Will simply increment `PassedTests.i` and print \"Passed\" in the debug window\n\n`Fail(TestName.s=\"\")`\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Will simply increment `FailedTests.i` and print \"Failed\" in the debug window\n\n\u003cb\u003eGlobal Variables:\u003c/b\u003e\u003cbr\u003e\n`PassedUnitTests.i`: The number of passed tests\u003cbr\u003e\n`FailedUnitTests.i`: The number of failed tests\n\n\u003cb\u003eRemarks:\u003c/b\u003e\u003cbr\u003e\nThe `TestName.s` parameter is optional and will simply influence the text displayed in the debug window.\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\"Passed\" if `TestName.s` is empty or \"Passed -\u003e TestName.s\" otherwise.\u003cbr\u003e\n\u003cbr\u003e\n\n### [UUID4](UUID4.pb) ([Logger version](UUID4-Logger.pb))\nIn both version, you can generate a UUID4 by using the following procedure:\n\n``GenerateUUID4()``\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Returns a UUID4 String that matches the standard.\u003cbr\u003e\n\n``IsUUID4Compliant(uuid4$)``\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Returns a non-zero value if the string matches the regex.\u003cbr\u003e\n\nYou also have access to a regex (`#REGEX_ID_UUID4`) that lets you check if a String matches the UUID4 standard.\u003cbr\u003e\n\n# Enumerations Used\n* Regex (Used for regex IDs)\n* ErrorCode (Used with `End [Integer]`)\n\n# Usefull Links\n* [cli-args-pb](https://github.com/aziascreations/cli-args-pb): Launch parameters parser\n\n# Credits\nThe original authors and posts are also mentionned and linked in the source files.\n\n● Demivec\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ⚬ Strings - `ExplodeStringToArray(...)`\n\u0026nbsp;\u0026nbsp;([Thread](http://www.purebasic.fr/english/viewtopic.php?f=13\u0026t=41704))\u003cbr\u003e\n\n● Mistrel\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; ⚬ UUID4 - Original GUID generator\n\u0026nbsp;\u0026nbsp;([Thread](http://www.purebasic.fr/english/viewtopic.php?t=38008))\n\n# License\n[WTFPL](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faziascreations%2Fpb-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faziascreations%2Fpb-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faziascreations%2Fpb-utils/lists"}