{"id":27237,"date":"2022-01-12T17:15:56","date_gmt":"2022-01-12T16:15:56","guid":{"rendered":"https:\/\/help.qualiware.it\/qw-help\/?p=27237"},"modified":"2022-12-29T11:23:04","modified_gmt":"2022-12-29T10:23:04","slug":"utility-functions","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/utility-functions\/?lang=en","title":{"rendered":"UTILITY FUNCTIONS"},"content":{"rendered":"<p>QualiWare supports all the functions and classes of Visual Basic e C# available on the .NET 4.7.2 platform.<\/p>\n<p><strong>All these APIs are available in every script input inside QualiWare<\/strong>. These functions are a fundamental part in programming <a href=\"http:\/\/help.qualiware.it\/qw-help\/events\/?lang=en\">Form Designer events<\/a> and <a href=\"https:\/\/help.qualiware.it\/qw-help\/sd-task-scheduler\/?lang=en\">Server Daemon tasks<\/a>.<\/p>\n<p><strong><span style=\"color: #3366ff;\">NOTE: the functions explained here are written using the VB.NET syntax.<\/span><\/strong><\/p>\n<p>In order to make the programming work more confortable, QualiWare has a list of built-in functions.<\/p>\n<ul>\n<li><code>at(ByVal s1 As String, ByVal s2 As String, Optional ByVal n As Integer = 1) As Integer<\/code> &#8211; returns the position of the first character of the <code>n<\/code>-th occurrence of <code>s1<\/code> in <code>s2<\/code>. NOTE: the index system is 1-based.<\/li>\n<li><code>Array2String(ByVal a As DBArray, Optional ByVal separator As String = \",\") As String<\/code> &#8211; returns a string made by concatenating the elements of the DBArray object specified as first argument, and by using the <code>separator<\/code> string specified as second argument.<\/li>\n<li><code>CheckIfItemInList(ByVal list As String, ByVal item As String, Optional ByVal separator As String = Chr(13)) As Boolean<\/code> &#8211; checks if the <code>item<\/code> string appears at least one time in the <code>list<\/code> string, using the <code>separator<\/code> string to distinguish the different list elements.<\/li>\n<li><code>ctod(ByVal dateValue As String As String) As Date<\/code> &#8211; transform the specified string into a date object, using the format of the current tongue.<\/li>\n<li><code>dtoc(ByVal dateValue As Date, Optional ByVal fmt As String = Nothing) As String<\/code> &#8211; transform the specified date into a string object, using the format of the current tongue or the one specified as second argument.<\/li>\n<li><code>Empty(ByVal expression As Object) As Boolean<\/code> &#8211; returns <code>True<\/code> if the specifies expression is &#8220;empty&#8221;. The &#8220;empty&#8221; value can be of different types:\n<ul>\n<li>String: <code>\"\"<\/code> or <code>Nothing<\/code><\/li>\n<li>Number: <code>0<\/code><\/li>\n<li>Date: empty date<\/li>\n<li>Boolean: <code>False<\/code><\/li>\n<li>Object: <code>Nothing<\/code><\/li>\n<\/ul>\n<\/li>\n<li><code>File(ByVal path As String) As Boolean<\/code> &#8211; checks if the file corresponding to the specified path exists.<\/li>\n<li><code>Lower(ByVal str As String) As String<\/code> &#8211; transform the string into lowercase.<\/li>\n<li><code>max(ByVal a As Object, ByVal b As Object) As Object<\/code> &#8211; returns, between two values, the maximum one.<\/li>\n<li><code>min(ByVal a As Object, ByVal b As Object) As Object<\/code> &#8211; returns, between two values, the minimum one.<\/li>\n<li><code>rat(ByVal s1 As String, ByVal s2 As String, Optional ByVal n As Integer = 1) As Integer<\/code> &#8211; returns the position of the first character of the <code>n<\/code>-th occurrence of <code>s1<\/code> in <code>s2<\/code>, starting from the last character of <code>s2<\/code>. NOTE: the index system is 1-based.<\/li>\n<li><code>replicate(ByVal str As String, ByVal n As Integer) As String<\/code> &#8211; returns a string made by repeating the <code>str<\/code> variable <code>n<\/code> times.<\/li>\n<li><code>Str(ByVal num As Object, Optional ByVal nChars As Integer = 15, Optional ByVal ndec As Integer = 0) As String<\/code> &#8211; returns a string obtained by transforming <code>num<\/code> into a string of <code>nChars<\/code> characters with a number of decimals equal to <code>ndec<\/code>.<\/li>\n<li><code>String2Array(ByVal s As String, Optional ByVal separator As String = \",\", Optional ByVal noRemoveEmpty As Boolean = True) As DBArray<\/code> &#8211; returns a DBArray object obtained by dividing the <code>s<\/code> string on the basis of the specified <code>separator<\/code> string. If the third parameter is <code>True<\/code>, it keeps any empty elements.<\/li>\n<li><code>Substring(ByVal s As String, ByVal start As Integer, Optional ByVal nChars As Integer = Integer.MaxValue) As String<\/code> &#8211; returns the substring of <code>s<\/code> obtained by starting from the character in the <code>start<\/code> position and including a number of characters equal to <code>nChars<\/code>. NOTE: the index system is 1-based.<\/li>\n<li><code>Upper(ByVal str As String) As String<\/code> &#8211; transform the string into lowercase.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>QualiWare supports all the functions and classes of Visual Basic e C# available on the .NET 4.7.2 platform. All these APIs are available in every script input inside QualiWare. These functions are a fundamental part in programming Form Designer events and Server Daemon tasks. NOTE: the functions explained here are written using the VB.NET syntax.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[98],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/27237"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=27237"}],"version-history":[{"count":1,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/27237\/revisions"}],"predecessor-version":[{"id":29785,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/27237\/revisions\/29785"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=27237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=27237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=27237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}