B4A.PM.JOBI.GET-PACKAGE-NAME

Summary

Object type
JOBI
Object Folder
PACKAGES/BEST4AUTOMIC/B4A.PM/SOURCE
Title
Extracts the package name from an object name
Archive Key 1
-
Archive Key 2
-
Created
WRITER/B4A am: 2022-03-24 08:03:07
Last Modified
WRITER/B4A am: 2024-01-09 10:39:01 8 x
Last Used
-

Description

Extracts the package name from an object name

Parameter

$OBJECT$
Object name

Input

Output

&B4AP_PACKAGE_NAME_O#
object name ended for usage in URLs
&B4AP_PACKAGE_PREFIX_O#
object name ended for usage in URLs

Example

:inc B4A.PM.JOBI.GET-PACKAGE-NAME $OBJECT$ = “B4A.PM.SCRI.EXAMPLE”

Process

:set &B4AP_PACKAGE_NAME_O# = ""
:set &B4AP_PACKAGE_PREFIX_O# = ""
:set &NAME# = "$OBJECT$"
:set &dot# = str_find( &NAME#, "." )
:if &dot# > 0
:  set &dot# = &dot# - 1
:  set &B4AP_PACKAGE_PREFIX_O# = str_cut( &NAME#, 1, &dot# )
:  p "Prefix: &B4AP_PACKAGE_PREFIX_O#"
:  set &dot# = &dot# + 2
:  set &dot# = str_find( &NAME#, ".", &dot# )
:  if &dot# > 0
:    set &dot# = &dot# - 1
:    set &B4AP_PACKAGE_NAME_O# = str_cut( &NAME#, 1, &dot# )
:  else
:    set &B4AP_PACKAGE_NAME_O# = &NAME#
:  endif
:  p "Package: &B4AP_PACKAGE_NAME_O#"
:endif