Docs
ServoyCloudSupportSamplesOpen SourceCommunity
  • Home
  • GUIDES
    • Platform Overview
    • Get Servoy
    • Get Started
      • Chapter 0
      • Chapter 1
      • Chapter 2
      • Chapter 3
      • Chapter 4
      • Chapter 5
    • Get Help
      • SuLA Instructions
      • SuLA Terms
    • Develop
      • Application Design
        • Forms
          • Layout Management
            • Simple Layout
            • Fully Responsive
              • Bootstrap 12-Grid
              • Flexbox
              • Custom Div
              • Collapsible Container
              • Simple Collapsible
              • Center Container
              • Inline Group Container
            • Abstract Form
          • Form Containers
            • Form Container
            • Tab Panel
            • Split Pane
            • Collapse
            • Accordion Panel
            • Form Component
            • List Form Component
          • Form Inheritance
          • Form Components
        • UI Components
          • Buttons and Text
            • Badge
            • Button
            • Data Label
            • Dropdown
            • Image
            • Label
          • Grids
            • Data Grid
            • Power Grid
            • Table
          • Input Controls
            • Calendar
            • Calendar Inline
            • Checkbox
            • Choice Group
            • Combobox
            • Group Buttons
            • Html Area
            • Input Group
            • Rating
            • Slider
            • Switch
            • Spinner
            • TextArea
            • Textbox
            • TextBoxGroup
            • Type Ahead
            • select2tokenizer
          • Media
            • Carousel
            • Embedded YouTube
            • File upload
            • Image label
            • Lightbox Gallery
            • MultiFile Upload
            • PDF JS Viewer
            • PDF Viewer
          • Mobile
            • Native Data List
            • Native Select
          • Navigation
            • Breadcrumbs
            • Navbar
            • sidenav
          • Visualization
            • DBTreeview
            • Progress Bar
            • Treeview
            • ChartJS
              • Data Labels Plugin
              • Funnel Chart
              • OutLabels Plugin
              • TreeMap
          • Specialized Components
            • Smart Document Editor
            • Servoy PDF Viewer
            • Fullcalendar Component
              • Fullcalendar
              • Fullcalendar Events
              • Migrating calendar from Smart and Web client to NG client
            • Fullcalendar Component 2
            • Canvas
            • Google Charts
            • Google Maps
            • svySignature
            • svywebcam
        • Styling and Themes
          • Default Theme Properties
          • CSS / LESS
          • Component Variants
          • Font Icons
        • Data Modeling
          • Databases
            • Tables
              • Columns
              • Calculations
              • Aggregations
              • Methods
              • Events / Triggers
              • Table security
            • Views
            • Procedures
          • Relations
          • Value Lists
          • Menus
          • In-Memory Databases
          • View Datasource
        • Modular Design
      • Programming Guide
        • Scripting the UI
          • Scripting Forms
          • Interacting with Components
          • Navigation
          • Windows, Dialogs and Popups
          • Events Manager
        • Working with Data
          • Concepts
          • Loading
          • Sorting
          • Iterating
          • Searching
            • Find mode
            • Query Builder
            • SQL String
          • Filtering
          • Editing
          • Validation
        • Automation and Scheduling
          • Batch Processor
          • Headless API
          • Scheduler API
        • Creating REST APIs
        • Consuming Webservices
        • Working with Files
          • File Plugin Basics
          • Images
          • Excel
          • PDF
          • JSON
        • Browser Utilities
          • Notifications
            • Web Notifications (Toastr)
            • Web Notifications (Native)
            • Block UI
          • Session Management
          • Keyboard Utilities
          • NG Utils
        • Sending and Receiving Email
        • Servoy Jasper Reports
          • Input Type
          • Display Mode
          • Output format
          • Jaspe Reports Viewer
        • Extensions
          • Modules
            • svyPhonegap
              • First Use Guide
              • Barcode Scanner
              • Browser
              • Camera
              • File
              • Fingerprint
              • Location
              • Network Interface
              • Phonegap
              • Printer
              • Push Notifications
            • svyAPI
              • Getting Started
            • svyLookup
              • Custom Templates
              • API Documentation
              • svyLookup v1
                • API Documentation v1.0.0
                • Base Form svyLookupTable v1.0.0
                • Base Form AbstractLookup v1.0.0
            • svyNavigation
              • API Documentation
                • API svyNavigation
                • API svyNavigationHistory
                • API svyNavigationUX
            • svyPopupFilter
              • Simple Filter Pickers
              • Custom Templates
              • API Documentation
                • API svyToolbarFilter
                • API svyPopupFilter
              • API Documentation v1
                • API svyToolbarFilter v1
                • API svyPopupFilter v1
            • svySearch
            • svySecurity
              • Overview
              • Token-based Auth and SSO (NEW!)
              • API Documentation
              • Getting Started
              • Tenant replication
              • Security Management Console
                • Classic Security Management Console
              • svySecurityUX
              • svyProperties
              • API Doc svyProperties
            • svyUtils
              • Log Manager
              • Log Manager Appenders
              • Smart Doc Editor Utils
              • Custom Dialogs
              • Excel Utils
                • Full API Reference
              • Crypto Utils
      • Security
        • Authentication
        • Permissions
          • UI Permissions
          • Data Permissions
          • Runtime Permissions
        • Audit Logging
        • OAuth
        • JWT
      • Multi-Language Support
      • Mobile Development
        • Getting Started
        • Mobile Design
        • Native Mobile Integrations
        • Building a Native Binary for the App Store
      • Native Desktop Development
        • NGDesktop UI plugin
        • NGDesktop Utils
        • NGDesktop File Plugin
    • Deploy
      • WAR Deployment
      • Docker Deployment
      • Server Configuration
        • Server Settings
        • Server Plugins
        • Database Servers
          • Locks
          • Transactions
          • Oracle
          • SQLServer
        • Client Sessions
        • Batch Processors
        • License Management
        • Monitoring
          • Server Log
          • Browser Console Log
          • Websocket Log
          • Query Performance
          • Client Performance
          • Client Event Tracing
          • Monitoring Servoy with JMX
      • NGClient deployment
      • Troubleshooting
      • Other Topics
        • Security: Cross-site Scripting
        • Running in an iFrame
    • Extend
    • Contribute
  • Reference
    • Servoy Core
      • Object Model
        • Database Server
          • Table
            • Column
            • Calculation
            • Method
            • Aggregation
          • View
          • Procedure
        • Solution
          • Form
          • Form Component
          • Relation
          • Relation Item
          • Table Node
          • Value List
          • Menu
          • Menu item
          • In-Memory Data Source
          • View Foundset Data Source
          • Variable
          • Column Info
          • Media
          • Layout Container
          • Method
        • i18n Message Key
      • Developer API
        • Globals
        • Forms
          • RuntimeForm
            • controller
            • containers
              • RuntimeContainer
            • elements
              • Component
              • RuntimeAccordionPanel
              • RuntimeBean
              • RuntimeButton
              • RuntimeCalendar
              • RuntimeCheck
              • RuntimeCombobox
              • RuntimeComponent
              • RuntimeDataButton
              • RuntimeDataLabel
              • RuntimeGroup
              • RuntimeHtmlArea
              • RuntimeImageMedia
              • RuntimeInsetList
              • RuntimeLabel
              • RuntimeListBox
              • RuntimePassword
              • RuntimePortal
              • RuntimeRadio
              • RuntimeChecks
              • RuntimeRadios
              • RuntimeRectangle
              • RuntimeRtfArea
              • RuntimeSpinner
              • RuntimeSplitPane
              • RuntimeTabPanel
              • RuntimeTextArea
              • RuntimeTextField
              • RuntimeWebComponent
        • JS Lib
          • Array
          • BigInt
          • Boolean
          • Date
          • Function
          • IterableValue
          • Iterator
          • JSON
          • Map
          • Set
          • Math
          • Namespace
          • Number
          • Object
          • Promise
          • QName
          • RegExp
          • Special Operators
          • Statements
          • String
          • XML
          • XMLList
        • Application
          • APPLICATION_TYPES
          • CLIENTDESIGN
          • DRAGNDROP
          • ELEMENT_TYPES
          • LOGGINGLEVEL
          • NGCONSTANTS
          • UICONSTANTS
          • CSSPosition
          • JSDimension
          • JSDNDEvent
          • JSEvent
          • JSLogger
          • JSLogBuilder
          • JSPoint
          • JSUpload
          • JSWindow
          • JSBounds
          • Renderable
          • UUID
        • SolutionModel
          • ALIGNMENT
          • ANCHOR
          • BEVELTYPE
          • CURSOR
          • DEFAULTS
          • FONTSTYLE
          • MEDIAOPTION
          • PAGEORIENTATION
          • PRINTSLIDING
          • SCROLLBAR
          • TITLEJUSTIFICATION
          • TITLEPOSITION
          • UNITS
          • JSBean
          • JSButton
          • JSCalculation
          • JSComponent
          • JSDataSourceNode
          • JSField
          • JSForm
          • JSLabel
          • JSMedia
          • JSMethod
          • JSPart
          • JSPortal
          • JSRelation
          • JSRelationItem
          • JSStyle
          • JSTab
          • JSTabPanel
          • JSValueList
          • JSVariable
          • JSTitle
          • JSChecks
          • JSCombobox
          • JSHeader
          • JSInsetList
          • JSList
          • JSPassword
          • JSRadios
          • JSText
          • JSTextArea
          • JSWebComponent
          • JSLayoutContainer
        • Database Manager
          • QUERY_COLUMN_TYPES
          • SQL_ACTION_TYPES
          • JSColumn
          • JSDataSet
          • JSBaseRecord
          • JSBaseSqlRecord
          • JSBaseFoundset
          • JSBaseSQLFoundset
          • JSFoundSet
          • JSFoundSetUpdater
          • JSRecord
          • JSRecordMarker
          • JSRecordMarkers
          • JSTable
          • JSTableFilter
          • MenuFoundSet
          • MenuItemRecord
          • QBAggregate
          • QBAggregates
          • QBCase
          • QBCaseWhen
          • QBColumn
          • QBColumns
          • QBCondition
          • QBFunction
          • QBFunctions
          • QBGroupBy
          • QBJoin
          • QBJoins
          • QBLogicalCondition
          • QBParameter
          • QBParameters
          • QBPart
          • QBResult
          • QBSearchedCaseExpression
          • QBSelect
          • QBSort
          • QBSorts
          • QBTableClause
          • QBWhereCondition
          • ViewFoundSet
          • ViewRecord
        • Events Manager
          • EVENTS_AGGREGATION_TYPES
          • EventType
        • Menus
          • JSMenu
          • JSMenuItem
        • JSMenuDatasource
        • Utils
        • Client Utils
          • JSBlobLoaderBuilder
        • History
        • Security
        • i18n
        • ServoyException
          • DataException
        • JSUnit
        • Datasources
          • DBDataSource
          • DBDataSourceServer
          • JSConnectionDefinition
          • JSDataSource
          • MemDataSource
          • MenuDataSource
          • SPDataSource
          • SPDataSourceServer
          • ViewDataSource
        • JSViewDatasource
        • servoyDeveloper
        • enum
    • Extensions
      • UI Components
        • Buttons and Text
          • Badge
          • Button
          • Data Label
          • Drop Down
          • Image
          • Label
        • Form Containers
          • Accordion Panel
          • Collapse
          • Form Container
          • Form Component Container
          • List Form Component
          • Default Loading Indicator
          • Error Bean
          • Portal
          • Responsive Container
          • Servoy Default Navigator
          • Slider
          • Split Pane
          • TabPanel
        • Grids
          • Data Grid
          • Power Grid
          • Table
        • Input Controls
          • Calendar
          • Calendar Inline
          • Checkbox
          • Choice Group
          • Combobox
          • Floatinglabel Calendar
          • Floatinglabel Combobox
          • Floatinglabel Textarea
          • Floatinglabel Textbox
          • Floatinglabel Type Ahead
          • Group Buttons
          • Html Area
          • Input Group
          • Rating
          • Select2tokenizer
          • Slider
          • Spinner
          • Switch
          • TextArea
          • TextBox
          • TextBox Group
          • Type Ahead
        • Media
          • Carousel
          • Embedded YouTube
          • File upload
          • Image label
          • Lightbox Gallery
          • MultiFile Upload
          • PDF JS Viewer
          • PDF Viewer
        • Mobile
          • Native Data List
          • Native Select
        • Navigation
          • Breadcrumbs
          • Navbar
          • sidenav
        • SmartDocEditor
          • Smart Document Editor
        • Visualization
          • Canvas
          • Chart
          • Custom List
          • DBTreeview
          • Foundset List
          • Fullcalendar
          • Gauge
          • Google Maps
          • Kanban
          • Progress Bar
          • Treeview
      • Server Plugins
        • amortization
          • AmortizationCalculation
          • Polynomial
        • clientmanager
          • Broadcaster
          • JSClientInformation (cm)
        • excelxport
        • file
          • JSFile
          • JSProgressMonitor
        • headlessclient
          • JSClient
        • http
          • HTTP_STATUS
          • Cookie
          • DeleteRequest
          • GetRequest
          • HeadRequest
          • HttpClient
          • HttpClientConfig
          • OptionsRequest
          • PostRequest
          • PutRequest
          • Response
          • TraceRequest
          • PatchRequest
          • JSFileUpload
        • images
          • JSImage
        • jwt
          • Algorithm
          • Builder
          • JWTClaims
        • mail
          • Attachment
          • MailMessage
        • maintenance
          • JSClientInformation
          • JSColumnObject
          • JSServer
          • JSTableObject
        • mobileservice
          • OfflineDataDescription
        • oauth
          • ClientAuthentication
          • CustomApiBuilder
          • OAuthProviders
          • OAuthRequest
          • OAuthResponse
          • OAuthResponseBinary
          • OAuthResponseJSON
          • OAuthResponseText
          • OAuthService
          • OAuthServiceBuilder
          • OAuthTokenExtractors
          • RequestType
        • pdf_output
        • rawSQL
        • RestWs plugin
        • rest_ws
          • WsContents
          • WsCookie
          • WsRequest
          • WsResponse
        • scheduler
        • serialize
        • textxport
          • DataProviderExport
          • TabExporter
        • udp
          • JSPacket
        • XmlReader
          • XmlNode
      • Browser Plugins
        • Block UI
        • Block UI (ref)
        • Dialogs Plugin
        • Idle
        • Idle (ref)
        • Key Listener
        • Key Listener (ref)
        • NGDesktop File
        • NGDesktop File (ref)
        • NGDesktop UI (ref)
        • NGDesktop Utils (ref)
        • NG Utils (ref)
        • Office Javascript API for Servoy
        • Phonegap
        • Web Notifications (Native)
        • Web Notifications (Toastr)
        • Window Plugin
        • Font Awesome
      • Modules
        • Smart Doc Editor Utils
        • svyAPI
          • Getting Started
        • svyLookup
          • Custom Templates
          • API Documentation
          • svyLookup v1
            • API Documentation v1.0.0
            • Base Form svyLookupTable v1.0.0
            • Base Form AbstractLookup v1.0.0
        • svyLookupExample
        • svyNavigation
          • API Documentation
            • API svyNavigation
            • API svyNavigationHistory
            • API svyNavigationUX
        • svyNavigationUX
        • svyNavigationUXSample
        • svyPopupFilter
          • Simple Filter Pickers
          • Custom Templates
          • API Documentation
            • API svyToolbarFilter
            • API svyPopupFilter
          • API Documentation v1
            • API svyToolbarFilter v1
            • API svyPopupFilter v1
        • svyProperties
        • svySearch
        • svySecurity
          • Overview
          • Token-based Auth and SSO (NEW!)
          • API Documentation
          • Getting Started
          • Tenant replication
          • Security Management Console
            • Classic Security Management Console
          • svySecurityUX
          • svyProperties
          • API Doc svyProperties
        • svySecurityConsole
        • svySecurityUX
        • svyUtils
          • Log Manager
          • Log Manager Appenders
          • Smart Doc Editor Utils
          • Custom Dialogs
          • Excel Utils
          • Full API Reference
          • Crypto Utils
        • svyUtils$Excel
        • svyUtils$NGClient
        • svyUtils$customDialogs
        • svyUtils$logManagerAppenders
        • svyUtils$tableGrid
      • Layout
        • Boostrap 12grid layout
          • Collapsible Container
          • Simple Collapsible
          • Center Container
          • Inline Group Container
          • Flexbox Layout
      • Solutions
        • Sample Application
          • Tutorial Part 1
          • Tutorial Part 2
      • Packages
        • UI Component Packages
          • Advanced Renderers
          • Bootstrap Components
          • Bootstrap Extra Components
          • Canvas
          • Chart JS
          • Fullcalendar Component
          • googlemaps
          • kanban
          • Servoy Core
          • Servoy Extra Components
          • Servoy NG-Grids
          • Servoy PDF Viewer
          • smartDocumentEditor
        • Browser Plugin Packages
          • Block UI
          • Core NG only Services
          • Key Listener
          • NGDesktop File
          • NGDesktop UI
          • NGDesktop Utils
          • Web Notifications
          • Idle Web Service
    • Servoy Developer
      • Menu
        • File
        • Edit
        • Source
        • Refactor
        • Navigate
        • Search
        • Project
        • Actions
        • Run
        • Window
        • Help
      • Toolbar
      • Solution Explorer
        • Resources
          • Database Servers
            • Database Server
              • Procedures
              • Tables
              • Views
          • Security
          • i18n
        • All Solutions
          • Solution
          • Active Solution
            • Scopes
              • Scope
                • Variables
            • Forms
              • Working Set
              • Form
                • Controller
                • Variables
                • Elements
                • Relations
            • Form Components
              • Form Component
            • Relations
              • Relation
            • ValueLists
              • ValueList
            • Menus
              • Menu
                • MenuItem
            • Media
              • Folder
              • File
            • DataSources
              • In Memory DataSources
                • In Memory DataSource
              • View Foundsets DataSources
                • View Foundset DataSources
            • Servoy Packages
              • Package
            • Modules
              • Module
        • Solution Explorer Contextual List
      • Views
        • Command Console
        • Console
        • Problems
        • Tasks
        • Bookmarks
        • Search
        • Form Hierarchy
        • Help
        • JUnit
        • Outline
        • Profiler
        • Properties
        • Project Explorer
        • Call Hierarchy
      • Editors and Wizards
        • Property configurator for columns
        • Relation Editor
        • Text Format Editor
        • Date Format Editor
        • Number Format Editor
        • Database Synchronization Wizard
        • Security Editor
        • SQL Editor
        • i18n Editor
        • File Import Wizard
        • File Export Wizard
        • WAR Export Wizard
        • NGDesktop Export Wizard
        • Table Editor
        • Metadata Synchronization Wizard
        • Database Server Connection Editor
        • Text Property Editor
        • Valuelist Editor
        • Form Editor
          • Parts of the Form Editor
          • Designing a Form
          • Layout Tools
          • Using Containers
          • Creating and Using Forms
          • Using Servoy Beans
          • Using Shapes
          • Form Editor Subtabs
          • [Tips and Shortcuts][reference/servoy-developer/object-editors/form-editor-tips_and_shortcuts.md]
          • Editong a Responsive LayoutForm
          • CSS Positioning
        • Form Hierarchy
        • Component Properties Editor
        • Variable Editor
        • Method Selection Wizard
        • New Solution Wizard
        • Application Event Types Editor
        • New Form Wizard
        • Form Dataproviders Configurator
        • Servoy Resource Locator
        • Datasource Selection Wizard
        • Sorting Fields Wizard
        • Scripting Editor
          • Getting Started-Overview of Script Editor
          • Code Writing Features
          • Code Navigation
          • Code Rewriting Tools
          • Refactoring
          • Code Formatting
          • Script Editor Tips and Shortcuts
          • Unit Tests
        • Theme Editor
          • General Properties
          • Sidenav Properties
          • Navbar Properties
          • Tabs Properties
          • Windows Properties
          • Dialogs Properties
          • Tables Properties
          • Breadcrumb specific style Properties
          • Brand colors Properties
          • Validations Properties
          • Margins and Padding Properties
        • Editor Selection
        • Run Configurations
        • Debug Configurations
        • Externalize Strings Wizard
        • Font Chooser Wizard
        • Color Chooser Wizard
        • Project Properties Configurator
        • Move Wizard
        • External Tools Configurations
        • About Servoy Developer
        • Servoy Developer Installation Details
        • Eclipse Marketplace Wizard
        • Install Available Software Wizard
        • Cheat Sheet Selection Wizard
        • Servoy Developer Help Wizard
        • Switch to Editor Wizard
        • Find Actions Wizard
        • Customize Perspective Configurator
        • Quick Search Wizard
        • Search Wizard
        • Encoding Wizard
        • Task Wizard
        • Find - Replace Wizard
        • Properties Editor
        • New Project Wizard
        • New Method Wizard
        • New Menu Wizard
          • New MenuItem Wizard
        • Menu Editor
        • ServoyMenu Selection Wizard
        • JSMenu compatible component selector
        • Permissions Configuration Dialog
      • Project File Structure
        • Servoy Installation Directory
          • servoy.properties
        • Workspace Folder
          • Resources Directory
            • Database Information (.dbi) Files
          • Solution Folder
      • Package Manager
      • Preferences
      • Property Types for components / services
      • Debugger
        • Debug Explorer
        • Breakpoints
          • Breakpoint Properties
        • Variables
        • Expressions
        • Interactive Console
    • Application Server
    • Servoy Cloud
      • Cloud Control Center
        • Home
          • Setup Namespace
          • User profile
            • My Profile
            • Support
        • Download IDE
        • Application Overview
          • Applications
            • Pipelines
              • Jobs
                • Packages
                  • Commits
                  • Artifacts
                  • Configuration
                  • Quality reports
                  • Build markers
                • Job Configuration
                  • Build and Deploy or Build
                  • Mobile
                  • Desktop
            • Environments
              • Metrics
                • Users
                • Databases
                  • Metrics
                • System Health
                • Log Activity
                • App performance
                • Query performance
              • Cloud reporting
            • Security
              • Permissions
              • Tenants
            • Reports
            • Security Login Designer
              • Single Sign-On
                • Sign in with Google
                • Sign in with Microsoft
          • Code Repositories
        • Project Management
          • Tickets
          • Backlog
          • Active Sprints
        • User Management
          • Users
          • Roles
        • Administration
          • Security
            • ServoyCloud Roles
          • Credentials
          • Settings
        • Add-Ons
      • Database Backup
      • E2E Cypress Testing
        • Using Cypress
      • On-Premise Deployment
      • Privacy policy (ServoyAI)
      • FAQ
      • Migrate to Servoy Cloud
    • Extensions Developement
      • Component and Services
        • Component Development
        • Service Development
        • Tools and Dev Tips to use for Component/Service developement
        • Manifest (.mf file)
        • Specification (.spec file)
          • Property Types
            • Array property types
            • Custom object property types
            • Findmode property type
            • Foundset property type
            • Tags
        • Directives And Filters
          • Sablotabsequence
        • Console (serverside)
        • ServoyApi (serverside)
      • Serverside Plugins
        • Data Convertors and Validators
        • UI Convertors
  • Release notes
    • Release notes
      • 2025.03
      • 2024.03 (LTS)
      • 2023.03 (LTS)
      • 2025.03 (Servoy Cloud)
      • 2024.12
      • 2024.12 (Servoy Cloud)
      • 2024.09
      • 2024.09 (Servoy Cloud)
      • 2024.06
      • 2024.06 (Servoy Cloud)
      • 2024.03 (Servoy Cloud)
      • 2023.12
      • 2023.12 (Servoy Cloud)
      • 2023.09
      • 2023.09 (Servoy Cloud)
      • 2023.06
      • 2022.03 (LTS)
      • 2022.12 What's new
      • 2022.12
      • 2022.09 What's new
      • 2022.09
      • 2022.06 What's new
      • 2022.06
      • 2021.03.3 (LTS)
Powered by GitBook
On this page
  • Overview
  • Methods Summarized
  • Methods Detailed
  • base64ToBytes(base64String:)
  • base64ToString(base64String:)
  • bytesToBase64(byteArray:)
  • bytesToHex(bytearray)
  • bytesToString(byteArray:)
  • dateFormat(date, format)
  • dateFormat(date, format, timezone)
  • dateFormat(date, format, language, country)
  • dateFormat(date, format, timezone, language, country)
  • getUnicodeCharacter(unicodeCharacterNumber)
  • hasRecords(foundset)
  • hasRecords(record, relationString)
  • hexToBytes(hex)
  • hexToString(hex)
  • isMondayFirstDayOfWeek()
  • numberFormat(number, digits)
  • numberFormat(number, digits, language, country)
  • numberFormat(number, format)
  • numberFormat(number, format, language, country)
  • parseDate(date, format)
  • parseDate(date, format, timezone)
  • parseDate(date, format, language, country)
  • parseDate(date, format, timezone, language, country)
  • stringEscapeMarkup(textString)
  • stringEscapeMarkup(textString, escapeSpaces)
  • stringEscapeMarkup(textString, escapeSpaces, convertToHtmlUnicodeEscapes)
  • stringFormat(text_to_format, parameters)
  • stringFormat(text, format)
  • stringIndexReplace(text, i_start, i_size, replacement_text)
  • stringInitCap(text)
  • stringLeft(text, i_size)
  • stringLeftWords(text, numberof_words)
  • stringMD5HashBase16(textString)
  • stringMD5HashBase64(textString)
  • stringMiddle(text, i_start, i_size)
  • stringMiddleWords(text, i_start, numberof_words)
  • stringPBKDF2Hash(textString)
  • stringPBKDF2Hash(textString, iterations)
  • stringPatternCount(text, toSearchFor)
  • stringPosition(textString, toSearchFor, i_start, i_occurrence)
  • stringReplace(text, search_text, replacement_text)
  • stringReplaceTags(text, scriptable)
  • stringRight(text, i_size)
  • stringRightWords(text, numberof_words)
  • stringToBase64(string:)
  • stringToBytes(string:)
  • stringToHex(string)
  • stringToNumber(textString)
  • stringToNumber(textString, decimalSeparator)
  • stringTrim(textString)
  • stringWordCount(text)
  • timestampToDate(date)
  • validatePBKDF2Hash(password, hash)

Was this helpful?

  1. Reference
  2. Servoy Core
  3. Developer API

Utils

(utils)

Overview

The Utils scripting object provides a range of utility methods for data transformation, formatting, and validation. It includes functionality for handling Base64 encoding and decoding, byte array manipulation, and string transformations such as escaping markup, formatting, and hashing. This makes it a versatile tool for managing data in different formats.

Key methods include base64ToBytes, which converts Base64-encoded strings to byte arrays, and bytesToBase64, which performs the reverse operation. The dateFormat method allows dates to be formatted based on specified patterns, with support for custom timezones and locales. Similarly, numberFormat enables precise number formatting, including locale-specific options.

Advanced string operations such as stringReplace, stringFormat, and stringTrim are complemented by security-focused methods like stringMD5HashBase16 and stringPBKDF2Hash, providing robust options for hashing and validation. For example, validatePBKDF2Hash ensures that a given password matches a hash, supporting modern cryptographic standards like SHA256.

The object also facilitates Unicode character conversion, checks for related records using hasRecords, and parses strings into date objects with parseDate, offering rich functionality for varied use cases.

Methods Summarized

Type
Name
Summary

Return the byte array representation of the Base64 value

Return the String representation of the Base64 value

Return the Base64 value representation of the byteArray

Return the string conversion of the byteArray

Format a date object to a text representation.

Format a date object to a text representation using the format and timezone given.

Format a date object to a text representation.

Format a date object to a text representation using the format, timezone, language and country given.

Returns a string containing the character for the unicode number.

Returns true if the (related)foundset exists and has records.

Returns true if the (related)foundset exists and has records.

Returns true when Monday is the first day of the week for your current locale setting.

Format a number to have a defined fraction.

Format a number to have a defined fraction.

Format a number to specification.

Format a number to specification.

Parse a string to a date object.

Parse a string to a date object.

Parse a string to a date object.

Parse a string to a date object.

Returns the escaped markup text (HTML/XML).

Returns the escaped markup text (HTML/XML).

Returns the escaped markup text (HTML/XML).

Formats a string according to format specifiers and arguments.

Format a string using mask.

Replaces a portion of a string with replacement text from a specified index.

Returns all words starting with capital chars.

Returns a string with the requested number of characters, starting from the left.

Returns the number of words, starting from the left.

Returns the md5 hash (encoded as base16) for specified text.

Returns the md5 hash (encoded as base64) for specified text.

Returns a substring from the original string.

Returns a substring from the original string.

Returns the PBKDF2 hash for specified text.

Returns the PBKDF2 hash for specified text.

Returns the number of times searchString appears in textString.

Returns the position of the string to search for, from a certain start position and occurrence.

Replaces a portion of a string with replacement text.

Returns the text with %%tags%% replaced, based on provided record or foundset or form.

Returns a string with the requested number of characters, starting from the right.

Returns the number of words, starting from the right.

Return the Base64 representation of the string

Return the byte array representation of the string

Filters characters out of from a string and leaves digits, returns the number.

Filters characters out of from a string and leaves digits, returns the number.

Returns the string without leading or trailing spaces.

Returns the number of words in the text string.

Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).

Validates the given password against the given hash.

Methods Detailed

base64ToBytes(base64String:)

Return the byte array representation of the Base64 value

Parameters

Sample

var string = utils.base64ToBytes(base64String);

base64ToString(base64String:)

Return the String representation of the Base64 value

Parameters

Sample

var string = utils.base64ToString(base64Value);

bytesToBase64(byteArray:)

Return the Base64 value representation of the byteArray

Parameters

Sample

var string = utils.bytesToBase64(byteArray);
x`

bytesToHex(bytearray)

Parameters

Sample

var string = utils.bytesToHex(byteArray);

bytesToString(byteArray:)

Return the string conversion of the byteArray

Parameters

Sample

var string = utils.bytesToString(byteArray);

dateFormat(date, format)

Format a date object to a text representation.
This will format with the system timezone for the webclient
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)

Parameters

Sample

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss');

dateFormat(date, format, timezone)

Format a date object to a text representation using the format and timezone given.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)

Parameters

Sample

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss', "UTC");

dateFormat(date, format, language, country)

Format a date object to a text representation.
This will format with the system timezone for the webclient
With language and/or country the locale will be created.
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)

Parameters

Sample

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss', "fr", "CA");

dateFormat(date, format, timezone, language, country)

Format a date object to a text representation using the format, timezone, language and country given.
With the language and country given, the locale will be created.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)

Parameters

Sample

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss', "UTC", "fr", "CA");

getUnicodeCharacter(unicodeCharacterNumber)

Returns a string containing the character for the unicode number.

Parameters

Sample

//returns a big dot
var dot = utils.getUnicodeCharacter(9679);

hasRecords(foundset)

Returns true if the (related)foundset exists and has records. Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once

Parameters

Sample

//test the orders_to_orderitems foundset
if (myElement.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (myElement.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}

hasRecords(record, relationString)

Returns true if the (related)foundset exists and has records. Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once

Parameters

Sample

//test the orders_to_orderitems foundset
if (myElement.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (myElement.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}

hexToBytes(hex)

Parameters

Sample

var array = utils.hexToBytes(hex);

hexToString(hex)

Parameters

Sample

var string = utils.hexToString(hex);

isMondayFirstDayOfWeek()

Returns true when Monday is the first day of the week for your current locale setting.

Sample

if(utils.isMondayFirstDayOfWeek())
{
	//a date calculation
}

numberFormat(number, digits)

Format a number to have a defined fraction.

Parameters

Sample

var textalNumber = utils.numberFormat(16.749, 2); //returns 16.75

numberFormat(number, digits, language, country)

Format a number to have a defined fraction.

Parameters

Sample

var textalNumber = utils.numberFormat(16.749, 2, "fr", "CA"); //returns 16.75

numberFormat(number, format)

Format a number to specification.

Parameters

Sample

var textalNumber2 = utils.numberFormat(100006.749, '#,###.00'); //returns 100,006.75

numberFormat(number, format, language, country)

Format a number to specification.

Parameters

Sample

var textalNumber2 = utils.numberFormat(100006.749, '#,###.00', "fr", "CA"); //returns 100,006.75

parseDate(date, format)

Parse a string to a date object. This parses the date using the TimeZone of the server Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'

Parameters

Sample

var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss');

parseDate(date, format, timezone)

Parse a string to a date object. Using the timezone that is given, if null then it formats it with the clients timezone.

see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'

Parameters

Sample

var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss');

parseDate(date, format, language, country)

Parse a string to a date object. Using language and country that are given, if null then it formats it with the locale of the client

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'

Parameters

Sample

var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss', 'en', 'US');

parseDate(date, format, timezone, language, country)

Parse a string to a date object. Using the timezone, language and country that are given, if null then it formats it with the timezone and locale of the client

see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'

Parameters

Sample

var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss', 'GMT+3', 'en', 'US');

stringEscapeMarkup(textString)

Returns the escaped markup text (HTML/XML).

Parameters

Sample

var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')

stringEscapeMarkup(textString, escapeSpaces)

Returns the escaped markup text (HTML/XML).

Parameters

Sample

var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')

stringEscapeMarkup(textString, escapeSpaces, convertToHtmlUnicodeEscapes)

Returns the escaped markup text (HTML/XML).

Parameters

Sample

var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')

stringFormat(text_to_format, parameters)

Formats a string according to format specifiers and arguments.

Parameters

Sample

// the  format specifier has the syntax: %[argument_index$][flags][width][.precision]conversion
// argument index is 1$, 2$ ...
// flags is a set of characters that modify the output format
// typical values: '+'(The result will always include a sign), ','(The result will include locale-specific grouping separators)
// width is a non-negative decimal integer indicating the minimum number of characters to be written to the output
// precision is a non-negative decimal integer usually used to restrict the number of characters
// conversion is a character indicating how the argument should be formatted
// typical conversion values: b(boolean), s(string), c(character), d(decimal integer), f(floating number), t(prefix for date and time)
// Date/Time Conversions (used after 't' prefix):
		// 'H' 	Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e. 00 - 23.
		// 'I' 	Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e. 01 - 12.
		// 'k' 	Hour of the day for the 24-hour clock, i.e. 0 - 23.
		// 'l' 	Hour for the 12-hour clock, i.e. 1 - 12.
		// 'M' 	Minute within the hour formatted as two digits with a leading zero as necessary, i.e. 00 - 59.
		// 'S' 	Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e. 00 - 60 ("60" is a special value required to support leap seconds).
		// 'L' 	Millisecond within the second formatted as three digits with leading zeros as necessary, i.e. 000 - 999.
		// 'p' 	Locale-specific morning or afternoon marker in lower case, e.g."am" or "pm". Use of the conversion prefix 'T' forces this output to upper case.
		// 'z' 	RFC 822 style numeric time zone offset from GMT, e.g. -0800.
		// 'Z' 	A string representing the abbreviation for the time zone.
		// 'B' 	Locale-specific full month name, e.g. "January", "February".
		// 'b' 	Locale-specific abbreviated month name, e.g. "Jan", "Feb".
		// 'h' 	Same as 'b'.
		// 'A' 	Locale-specific full name of the day of the week, e.g. "Sunday", "Monday"
		// 'a' 	Locale-specific short name of the day of the week, e.g. "Sun", "Mon"
		// 'C' 	Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99
		// 'Y' 	Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar.
		// 'y' 	Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99.
		// 'j' 	Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar.
		// 'm' 	Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13.
		// 'd' 	Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31
		// 'e' 	Day of month, formatted as two digits, i.e. 1 - 31.

		// common compositions for date/time conversion
		// 'R' 	Time formatted for the 24-hour clock as "%tH:%tM"
		// 'T' 	Time formatted for the 24-hour clock as "%tH:%tM:%tS".
		// 'r' 	Time formatted for the 12-hour clock as "%tI:%tM:%tS %Tp". The location of the morning or afternoon marker ('%Tp') may be locale-dependent.
		// 'D' 	Date formatted as "%tm/%td/%ty".
		// 'F' 	ISO 8601 complete date formatted as "%tY-%tm-%td".
		// 'c' 	Date and time formatted as "%ta %tb %td %tT %tZ %tY", e.g. "Sun Jul 20 16:17:00 EDT 1969".

utils.stringFormat('%s Birthday: %2$tm %2$te,%2$tY',new Array('My',new Date(2009,0,1))) // returns My Birthday: 01 1,2009
utils.stringFormat('The time is: %1$tH:%1$tM:%1$tS',new Array(new Date(2009,0,1,12,0,0))) // returns The time is: 12:00:00
utils.stringFormat('My %s: %2$.0f, my float: %2$.2f',new Array('integer',10)) // returns My integer: 10, my float: 10.00
utils.stringFormat('Today is: %1$tc',new Array(new Date())) // returns current date/time as:  Today is: Fri Feb 20 14:15:54 EET 2009
utils.stringFormat('Today is: %tF',new Array(new Date())) // returns current date as: Today is: 2009-02-20

stringFormat(text, format)

Format a string using mask.

Parameters

Sample

var formattedString = utils.stringFormat('0771231231', '(###)####-###'); //returns (077)1231-231

stringIndexReplace(text, i_start, i_size, replacement_text)

Replaces a portion of a string with replacement text from a specified index.

Parameters

Sample

//returns 'this was a test'
var retval = utils.stringIndexReplace('this is a test',6,2,'was');

stringInitCap(text)

Returns all words starting with capital chars.

Parameters

Sample

//returns 'This Is A Test'
var retval = utils.stringInitCap('This is A test');

stringLeft(text, i_size)

Returns a string with the requested number of characters, starting from the left.

Parameters

Sample

//returns 'this i'
var retval = utils.stringLeft('this is a test',6);

stringLeftWords(text, numberof_words)

Returns the number of words, starting from the left.

Parameters

Sample

//returns 'this is a'
var retval = utils.stringLeftWords('this is a test',3);

stringMD5HashBase16(textString)

Returns the md5 hash (encoded as base16) for specified text.

NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5

Parameters

Sample

var hashed_password = utils.stringMD5HashBase16(user_password)

stringMD5HashBase64(textString)

Returns the md5 hash (encoded as base64) for specified text.

NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5

Parameters

Sample

var hashed_password = utils.stringMD5HashBase64(user_password)

stringMiddle(text, i_start, i_size)

Returns a substring from the original string.

Parameters

Sample

//returns 'his'
var retval = utils.stringMiddle('this is a test',2,3);

stringMiddleWords(text, i_start, numberof_words)

Returns a substring from the original string.

Parameters

Sample

//returns 'is a'
var retval = utils.stringMiddleWords('this is a test',2,2);

stringPBKDF2Hash(textString)

Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security. It uses a default of 9999 iterations. The string that is returned can only be used in the utils.validatePBKDF2Hash(password,thisReturnValue) to check if this hash is a result of that password. This will always be false: utils.stringPBKDF2Hash("test") == utils.stringPBKDF2Hash("test"). Because for the same string in multiply calls it will not generate the same hash. So you can only check it like this: utils.validatePBKDF2Hash("test",utils.stringPBKDF2Hash("test"))

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

Parameters

Sample

var hashed_password = utils.stringPBKDF2Hash(user_password)

stringPBKDF2Hash(textString, iterations)

Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security. From Servoy 2024.3.1 on this method will use SHA256 (HmacSHA256) as the Hash Algorithm. Before that it did use SHA1 (HmacSHA1) as the Hash Algorithm, this does result in the a different length of the hash. The total hash length (including interations of 9999) for SHA256 is 87 that was 63. So you need to make sure you can store at least 87 characters in your database. (but make sure you can handle more for future updates)

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

Parameters

Sample

var hashed_password = utils.stringPBKDF2Hash(user_password,9999)

stringPatternCount(text, toSearchFor)

Returns the number of times searchString appears in textString.

Parameters

Sample

//returns 2 as count
var count = utils.stringPatternCount('this is a test','is');

stringPosition(textString, toSearchFor, i_start, i_occurrence)

Returns the position of the string to search for, from a certain start position and occurrence.

Parameters

Sample

//returns 4 as position
var pos = utils.stringPosition('This is a test','s',1,1)

stringReplace(text, search_text, replacement_text)

Replaces a portion of a string with replacement text.

Parameters

Sample

//returns 'these are cow 1 and cow 2.'
var retval = utils.stringReplace('these are test 1 and test 2.','test','cow');

stringReplaceTags(text, scriptable)

Returns the text with %%tags%% replaced, based on provided record or foundset or form.

Parameters

Sample

//Next line places a string in variable x, whereby the tag(%%TAG%%) is filled with the value of the database column 'company_name' of the selected record.
var x = utils.stringReplaceTags("The companyName of the selected record is %%company_name%% ", foundset)
//var otherExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails);
//var recordExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails.getRecord(i);
//Next line places a string in variable y, whereby the tag(%%TAG%%) is filled with the value of the form variable 'x' of the form named 'main'.
//var y = utils.stringReplaceTags("The value of form variable is %%x%% ", forms.main);
//The next sample shows the use of a javascript object
//var obj = new Object();//create a javascript object
//obj['x'] = 'test';//assign an named value
//var y = utils.stringReplaceTags("The value of object variable is %%x%% ", obj);//use the named value in a tag

stringRight(text, i_size)

Returns a string with the requested number of characters, starting from the right.

Parameters

Sample

//returns 'a test'
var retval = utils.stringLeft('this is a test',6);

stringRightWords(text, numberof_words)

Returns the number of words, starting from the right.

Parameters

Sample

//returns 'is a test'
var retval = utils.stringRightWords('this is a test',3);

stringToBase64(string:)

Return the Base64 representation of the string

Parameters

Sample

var string = utils.stringToBase64('This is A test');

stringToBytes(string:)

Return the byte array representation of the string

Parameters

Sample

var byteArray = utils.stringToBytes('This is A test');

stringToHex(string)

Parameters

Sample

var hex = utils.stringToHex(string);

stringToNumber(textString)

Filters characters out of from a string and leaves digits, returns the number. Uses locale decimal separator.

Parameters

Sample

//returns 65567
var retval = utils.stringToNumber('fg65gf567');

stringToNumber(textString, decimalSeparator)

Filters characters out of from a string and leaves digits, returns the number. Decimal separator is specified as parameter.

Parameters

Sample

//returns 65.567
var retval = utils.stringToNumber('fg65gf.567','.');

stringTrim(textString)

Returns the string without leading or trailing spaces.

Parameters

Sample

//returns 'text'
var retval = utils.stringTrim('   text   ');

stringWordCount(text)

Returns the number of words in the text string.

Parameters

Sample

//returns '4' as result
var retval = utils.stringWordCount('this is a test');

timestampToDate(date)

Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).

Parameters

Sample

var date = utils.timestampToDate(application.getTimeStamp());

validatePBKDF2Hash(password, hash)

Validates the given password against the given hash. The hash should be generated by one of the stringPBKDF2Hash(password [,iteration]) functions. If hash is null or empty string the method will return false. This method can handle the older generated hash values based on SHA1 (HmacSHA1) and the new SHA256 (HmacSHA256) hash values.

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

Parameters

Sample

if (utils.validatePBKDF2Hash(user_password, hashFromDb)) {
   // logged in
}

PreviousJSMenuDatasourceNextClient Utils

Last updated 5 months ago

Was this helpful?

base64String: the Base64 encoded string to convert to byte array

Returns: byteArray representation of the base64 string using UTF-8 charset for conversion

base64String: the Base64 value to convert to String

Returns: String decoded representation of the Base64 value using UTF-8 charset for conversion

byteArray: the byte array to convert to Base64 value

Returns: Base64 representation of the byte array using UTF-8 charset for conversion

bytearray the byte array to convert to hex encoded string

Returns: returns hex encoded string from bytearray

byteArray: the byte array to convert to

Returns: string representation of the byte array using UTF-8 charset for conversion

date the date

format the format to output

Returns: the date as text

date the date

format the format to output

timezone The timezone string to use to parse the date (like GMT+3), if null then the timezone of the current client is used.

Returns: the date as text

date the date

format the format to output

language language used to create locale

country country used along side language to create the locale

Returns: the date as text

date the date

format the format to output

timezone the timezone to use the format, if null then current client timezone is used.

language language used to create locale

country country used along side language to create the locale

Returns: the date as text

unicodeCharacterNumber the number indicating the unicode character

Returns: a string containing the unicode character

foundset the foundset to be tested

Returns: true if exists

record A JSRecord to test.

relationString The relation name.

Returns: true if the foundset/relation has records.

hex hex encoded string to be decoded into a byte array.

Returns: a byte array from hex encoded string

hex ;

Returns: returns decoded string from hex

Returns: true if Monday is first day of the week in current locale

number the number to format

digits nr of digits

Returns: the resulting number in text

number the number to format

digits nr of digits

language language used to create locale

country country used along side language to create the locale

Returns: the resulting number in text

number the number to format

format the format

Returns: the resulting number in text

number the number to format

format the format

language language used to create locale

country country used along side language to create the locale

Returns: the resulting number in text

date the date as text

format the format to parse the date

Returns: the date as date object

date the date as text

format the format to parse the date

timezone The timezone string to use to parse the date (like GMT+3)

Returns: the date as date object

date the date as text

format the format to parse the date

language language used to create locale

country country used along side language to create the locale

Returns: the date as date object

date the date as text

format the format to parse the date

timezone The timezone string to use to parse the date (like GMT+3)

language language used to create locale

country country used along side language to create the locale

Returns: the date as date object

textString the text to process

Returns: the escaped text

textString the text to process

escapeSpaces indicating to escape spaces

Returns: the escaped text

textString the text to process

escapeSpaces indicating to escape spaces

convertToHtmlUnicodeEscapes indicating to use unicode escapes

Returns: the escaped text

text_to_format the text to format

parameters the array with parameters

Returns: the formatted text

text the string to format

format the format

Returns: the resulting text

text the text to process

i_start the start index to work from

i_size the size of the text to replace

replacement_text the replacement text

Returns: the changed text string

text the text to process

Returns: the changed text

text the text to process

i_size the size of the text to return

Returns: the result text string

text to process

numberof_words to return

Returns: the string with number of words form the left

textString the text to process

Returns: the resulting hashString

textString the text to process

Returns: the resulting hashString

text the text to process

i_start the start index to work from

i_size the size of the text to return

Returns: the result text string

text to process

i_start start word index

numberof_words the word count to return

Returns: the string with number of words form the left and

textString the text to process

Returns: the resulting hashString

textString the text to process

iterations how many hash iterations should be done, minimum should be 1000 or higher.

Returns: the resulting hashString

text the text to process

toSearchFor the string to search for

Returns: the occurrenceCount that the search string is found in the text

textString the text to process

toSearchFor the string to search

i_start the start index to search from

i_occurrence the occurrence

Returns: the position

text the text to process

search_text the string to search

replacement_text the replacement text

Returns: the changed text string

text the text tags to work with

scriptable the javascript object or foundset,record,form to be used to fill in the tags

Returns: the text with replaced tags

text the text to process

i_size the size of the text to return

Returns: the result text string

text to process

numberof_words to return

Returns: the string with number of words form the right

string: the string to convert to Base64

Returns: Base64 encoded representation of the string using UTF-8 charset for conversion

string: the string to convert to bytes

Returns: byte array representation of the string using UTF-8 charset for conversion

string String to be encoded into hex

Returns: returns hex encoded string

textString the text to process

Returns: the resulting number

textString the text to process

decimalSeparator decimal separator

Returns: the resulting number

textString the text to process

Returns: the resulting trimmed string

text the text to process

Returns: the word count

date object to be stripped from its time elements

Returns: the stripped date object

password the password to test against

hash the hash the password needs to validate to.

Returns: true if his hash is valid for that password

Object
Array
Object
String
Object
String
Array
String
Object
String
Date
String
String
Date
String
String
String
Date
String
String
String
String
Date
String
String
String
String
String
Number
String
JSFoundSet
Boolean
JSRecord
String
Boolean
String
Array
String
String
Boolean
Number
Number
String
Number
Number
String
String
String
Number
String
String
Number
String
String
String
String
String
String
Date
String
String
String
Date
String
String
String
String
Date
String
String
String
String
String
Date
String
String
String
Boolean
String
String
Boolean
Boolean
String
String
Array
String
String
Object
String
String
Number
Number
String
String
String
String
String
Number
String
String
Number
String
String
String
String
String
String
Number
Number
String
String
Number
Number
String
String
String
String
Number
String
String
String
Number
String
String
Number
Number
Number
String
String
String
String
String
Object
String
String
Number
String
String
Number
String
Object
String
Object
Array
String
String
String
Number
String
String
Number
String
String
String
Number
Date
Date
String
String
Boolean
Array
String
String
String
String
String
String
String
String
String
Boolean
Boolean
Array
String
Boolean
String
String
String
String
Date
Date
Date
Date
String
String
String
String
String
String
String
String
String
String
String
String
String
String
String
Number
Number
String
String
String
String
String
Array
String
Number
Number
String
Number
Date
Boolean
base64ToBytes(base64String:)
base64ToString(base64String:)
bytesToBase64(byteArray:)
bytesToHex(bytearray)
bytesToString(byteArray:)
dateFormat(date, format)
dateFormat(date, format, timezone)
dateFormat(date, format, language, country)
dateFormat(date, format, timezone, language, country)
getUnicodeCharacter(unicodeCharacterNumber)
hasRecords(foundset)
hasRecords(record, relationString)
hexToBytes(hex)
hexToString(hex)
isMondayFirstDayOfWeek()
numberFormat(number, digits)
numberFormat(number, digits, language, country)
numberFormat(number, format)
numberFormat(number, format, language, country)
parseDate(date, format)