bs String

Beas Variables always string, if defined with "setvar"

Alternative is to declare variable with instance string or local string

Note: userevents working always with string declared with "setvar"

 

Max. length of strings:  theoretical no limitation, limitation only based on windows

Strings always saved in UTF8 format.

 

Working with SQL Database:

if you want to use string in SQL Database fields, you must convert this with format "dbstring"

 

setvar=myText=Hello World
update myTable set myField=<myText,dbstring> where ...

 

You can set the format with

setvar=ls_text=<ls_mystring,format>

or

setvar=ls_text=<%var("ls_mystring","format1","format 2",... )>

 

 

 

Function

Description

<string,date>

converts string to date-format

<string,num>

deletes thousand-dot-separator and replaces comma with dot. (for German decimal-format)

<string,space x>

enlarges String to x chars. <abc,space 4> returns "abc ". <abc,space 2> returns "ab"

<string,lefttrimrow xRow xLeft>

Extracts row xRow and trims xLeft chars from the left. The remaining blank spaces from the right are deleted

<string,lefttrim xLeft>

Trims xLeft chars from the left and deletes blank spaces

<string,left xLeft>

returns xLeft chars from the left

<string,trim>

Delete all space, tabs, cr_lf and char(160) from left and right site from the string and all "<P></P>" from right side

<string,lasttoken x>

 

Example

setvar=ls_value=red,blue,yellow
messagebox=<ls_value,lasttoken ,>

Returns: yellow

the  variable you can set in "" or define with char(). You can't work with placeholder.

Example: token is char 9

messagebox=<ls_value,lasttoken char(9)>   

 

<string,token xToken xTokensign>

 

Separator is "=" or the specified tokensign.

 

Example:

setvar=ls_value=a,b,c,d
messagebox=<ls_value,token 2 ,>   = "b"

the second variable you can set in "" or define with char(). You can't work with placeholder.

Example: token is char 9

messagebox=<ls_value,token 2 char(9)>   

 

<string,right xRight>

returns xRight chars from the right of the string

<string,len>

returns the len from string

Example

<hello world,len> return 11

<string,lower>

convert string to lower string

<string,upper>

convert string to upper string

<string,mid pos length>

returns a part-sequence of the string

Example

setvar=ls_value=Hello World
messagebox=<ls_value,mid 4 1>

Returns: o

<string,pos x>

gets the position of the first appearance of the character x.

x can be included in "..."

x can be done with char(ascii)

Example

setvar=ls_test=hello<tab>world
messagebox=<ls_test,pos char(9)> returns 6

<string,default x>

If String=NULL or String=leer then use the default "x"

Example:

<column,default hello>: if there is no content of column then returns "hallo"

<string,isnull x>

like default but only if content is "NULL"

<string,padr xtoken=xlength>

fills the String up to "xlength" chars from the left with the token "xToken".

Example:

setvar=ls_value=1
messagebox=<ls_value,padr 0=5> 

Return: 00001

<string,monthname>

if string is date then returns the month

<string,datename>

if string is date then returns the week-day

<string,rtf>

converts CR_LF to RTF-CR_LF

<string,time>

formats string to time in current user-language, e. g. 15 gets  15:00 or 3:00 pm

<string,time2sec>

Convert time to seconds

<string,string2price>

 

decimal separators would be corrected, thousands separators and currency removed.

e.g. English $ 1,234.56 to German system

1234.56

<string,string2currency>

Formatted a price field in a currency field

e.g. USD 1,234.56 will be USD

<string,tosql>

 

Example

setvar=ls_string=my name is 'tom'
sql=update mycolumn=N'<ls_string,tosql>' where primarycol='test'

 

now be.as update the string: my name is "tom", because a string with ' generate an error.

 

Better is do use "dbstring"

<string,dbstring>

 

if you want insert a string directly in a sql-command, then use allways this format.

 

MSSQL:

set N' before the string

set ' after the string

replace ' in the string

 

Example

setvar=ls_string="Hello 'World' "

Result: N'Hello ''World'' '

 

Example

setvar=ls_string="my name is 'tom' "
setvar=ls_id="1001"
sql=update mycolumn=<ls_string,dbstring> where primarycol='test'

 

<string,ascii>

Display the ascii-values from string

Exampe <ABC,ascii> return (65) (66) (67)

<string,trimhtml>

Trims trailing and leading empty html tags.

 

Example:

 

<p></p>Hello World to Hello World

Hello<br>World<span></span> to Hello<br>World

 

 

WEB-Developement

<string,html2text>

Replace all <, > and ' to { } and ´

<string,html2textarea>

Replace all <textarea and </textarea to {textarea and {/textarea

<string,html2num x>

This method is to check a numeric value in a string  and return it. The default behavior is to use the decimal system on base 10. It is possible to use a system based on 16 or 2 by using the x parameter. It is highly recommended to use this method to prevent sql injections.

 

Examples

setvar=ls_text=0815
setvar=ls_text=<ls_text,html2num> // 815
 
setvar=ls_text=Hello World
setvar=ls_text=<ls_text,html2num> // 0
 
setvar=ls_text=A100
setvar=ls_text=<ls_text,html2num 16> // A100
 
setvar=ls_text=XYZ500
setvar=ls_text=<ls_text,html2num 16> // 0
 
setvar=ls_text=1100101
setvar=ls_text=<ls_text,html2num 2> // 1100101

 

<string,html2html>

 

replace ` to &#38;

replace < to &lt; if this not a allowed attribut

close all opened html attributs

delete bad html attributs

 

allowed attributes:

all for table and standard formatting

 

setvar=ls_result=%var("ls_result","checkhtml")

 

Example

setvar=ls_html="<P>Hello World"

messagebox=<%var("ls_html","checkhtml")

=> <P>Hello World</P>

<string,dbhtml>

replace ` to &#8242;

<string,url2string>

Convert a url-String to normal String

Replace all %-Placeholder

<string,tourl>

replace all ascii < 33 and > 128 in %hex-values

example

setvar=ls_text=hello world

meldung=info$$<ls_text,tourl>

display "hello%20world"

<string,htmlcharset2string>

 

Replace all &xxx; - sequence with correct sign

&#[decimal];

&#x[hexadecimal];

 

and follow special signs

nbsp

amp

quot

lt

gt

apos

szlig

copy

reg

trade

laquo

qaquo

bull

middot

uml

cent

euro

pund

curren

yen

fnof

 

You can use it to convert strings from a xml file to Unicode Standard

 

Example:

setvar=ls_test=setvar=ls_test=Display "&": Special sign: &amp; HEX: &#x26; Decimal: &#38;
 
meldung=<ls_test,html2charset2string>

 

 

Hexa dezimal

Format

Description

<string,tohex>

convert a integer (0-255) in hexadecimal with 2 digits

0 = 00, 5=05, 255=FF...

<string,tolonghex>

convert to long hex with 3 Numbers

Example: 255=0000FF, 256 = 000100 and so on

(for coloring in HTML)

<string,hex2int>

convert a Hex-Value to Integer, Example FF = 255

setvar=ls_test=Erst%&FCsten
meldung=<ls_test,url2string>

10