BaselScript


× SPRACHE NACHRICHTEN BEISPIELE BEISPIELFILME INSTALLATION IMPRESSUM DATENSCHUTZ SUPPORT -------------- BESCHREIBUNG Einführung BASEL-Sprache Grundkenntnisse    • Feld auch Variable    • Array    • Hash-Array    • Mathem. und Vergleichsoperatoren    • Bedingungen    • Schleife    • Timer    • Datei    • Datensatz    • Verzeichnis    • Menu    • Dialog    • ListView (Ansichtsliste)    • Form Arbeiten mit Skripten    • Skripte    • Scriptstruktur    • Aufruf eines Skriptes    • Skript starten    • Skript beim Start der Anwendung starten    • Szene    • Szene Deklaration    • Szene laden und starten Arbeiten mit Feldern    • Feldwert speichern    • Feldwert wiederherstellen Arbeiten mit Arrays    • Hash-array Arbeiten mit Verzeichnissen    • Standardverzeichnisse    • Unterverzeichnis erstellen    • Unterverzeichnis löschen    • Verzeichnisinhalt Arbeiten mit Dateien    • Dateistruktur deklarieren    • Datei in Speicher einlesen    • Datensatz in Datei schreiben    • Datei speichern    • Eine Datei in eine andere Datei umschreiben    • Datei umbenennen    • Datei kopieren    • Datensätze löschen    • Datei löschen    • Eingabe in Datei aus dem Skript    • Anzahl ausgewählter Datensätze    • Datensatz N lesen    • Verschlüsseln    • Dateien zusammenführen    • Update file    • Datensätze zusammenführen    • Space reduzieren    • Teilstring in Datei ersetzen    • Datensatz nach ausgewähltem einfügen    • Neuen Datensatz vor ausagewähltem hinzufühgen Arbeiten mit Bildschirm    • Erklärungen    • Form oder Formular       •• Tile = text       •• Tile = input       •• Tile = button       •• Tile = rectangle       •• Tile = image       •• Tile = radiobutton       •• Tile = checkbox       •• Tile = togglebutton       •• Tile = seekbar       •• Tile = property       •• Property-Beispiel       •• Tile-Anweisungen    •  Dialog    • List view    • Menü    • Message/print    • Trace Arbeiten mit Grafik    • Draw image    • Draw line    • Draw rectangle    • Draw circle    • Draw ellipse    • Draw text    • Draw polygon    • Draw point Arbeit mit Sound Arbeit mit Musik Vibration Arbeit mit Server    • Image herunterladen    • Stream als csv-Datei herunterladen    • Sound herunterladen    • mp3-Datei herunterladen    • String von URL herunterladen    • Anweisungen nach Download    • Datei auf Server hochladen Aufruf einer Webseite Programm aus dem Skript ausführen Notifications Funktionen    • Allgemeine Funktionen    • String funktionen    • Math Funktionen    • Date Funktion    • Array-Funktionen    • File-Funktionen    • Verzeichnis-Funktionen    • Grafikfunktionen    • Form funktionen    • Tabellenfunktionen Google Maps App für Android    • Ort zeigen    • Suche nach Orten    • Navigation Mehrsprachige Skripte Skript erstellen.    • Skript mit dem Texteditor erstellen    • Skript auf PC erstellen    • Skript mithilfe von Vorlagen erstellen    • Skript mit Assistent erstellen    • Formularassistent    • Dialogassistent    • Menüassistent Registrierung und Login    • Meine Skripte Klonen des Android-Interpreters Copy script from Download Festlegen von Standardgrößen Mögliche Probleme beim Ausführen von Skripten    • Clinch-Situation    • Programm hängt    • Skriptstart und keine Änderungen sichtbar Reservierte Namen Globale Variable Standardparameter für Szenenkomponenten Einstellungen Liste der Unicode-Zeichen Fehlerdiagnose Einige Vergleiche bekannter Skriptsprachen mit BaselScript    • Menu    • Dialog    • List View    • Form    • Download file    • Draw circle ...
Beschreibung

                 

String function

All string functions are prefixed with "string."

Сhecking string for lower case
#res = $string.is_lower(#string)

Example 1:
#string = Test
#res = $string.is_lower(#string)
#res =0
Example 2:
#string = test
#res = $string.is_lower(#string)
#res =1

Сhecking string for upper case
#res = $string.is_upper(#string)

Example 1:
#string = Test
#res = $string.is_upper(#string)
#res =0
Example 2:
#string = TEST
#res = $string.is_upper(#string)
#res =1

Checking a string for a numeric value (only numeric symbols)
#res = $string.is_numeric(#string)

Example 1:
#string = -120.5
#res = $string.is_numeric(#string)
#res =0
Example 2:
#string = 1205
#res = $string.is_numeric(#string)
#res =1

Checking a string for a number value
#res = $string.is_number(#string)

Example 1:
#string = -120.5
#res =1
Example 2:
#string = -120.5x
#res =0


Checking a string for a integer value
#res = $string.is_integer(#string)

Example 1:
#string = 120
#res = $string.is_integer(#string)
#res =1
Example 2:
#string = 120.5
#res = $string.is_integer(#string)
#res =0

Convert Unicode value to string
#symbol=$unicode_to_string(#code)

Example:
#code="u25AF" or #code="U+25AF"
#delimiter=$unicode_to_string("u25AF")
print #delimiter
Result : ▯

Convert a integer value to Unicode symbol
#res=$int_to_char(number)

Example:
#res=$int_to_char(27)
Result: %

Convert a Unicode character to integer value
#res=$char_to_int(string)

Example:
#res=$char_to_int(%)
Result: 27

Extract substring from string
#s = $string.substring(#field, start[, length])

start - a position in string (0,1,2...)
length - a number of symbols
Example 1:
#field ="123abcd"
#sub=$string.substring(#field, 3,2)
#sub = ab
Example 2:
#field ="123abcd xy"
#sub=$string.substring(#field, 2)
#sub = "3abcd xy"

Extract one substring between two substrings
#string = $string.substr_between(#string, #substring1, #substring2)

Example:
#string = "111_abcdefghijkl_222"
#string = $string.substring_between(#string, "111". "222")
Result: #string="_abcdefghijkl_"

Extract all substrings between two substrings
#array = $string.all_substr_between(#string,#start,#end)

Example:
#string = "111_abcdefghijkl_222111nnnnnnnnnn222"
#start=111
#end=222
array #array[100]
#array = $string.all_substr_between(#string,#start,#end)
Result: array #array
#array]0] = _abcdefghijkl_
#array[1]=nnnnnnnnnn

Delete last symbol in string
#s = $string.del_last_symbol(#string)

Example:
#string ="123abcd"
#s = $string.del_last_symbol(#string)
Result: #s = 123abc

Strings concatenation
#s = $string.concate(#field1,field2...)
Example:
#t1= "ab" #t3="12"
#s =$string.concat(#t1,"cd",#t3)
Result:
#s = abcd12


Checking if a a string begins with a specified substring
#s = $string.starts_with(#string,#substring[,mode])
If mode is set to lower, then both #string and #substring will be converted for the test to lowercase.
Example:
#t1= "Abcdghj" #t2="a"
#s =$string.starts_with(#t1,#t2,lower)
Result:
#s = 1 (true)

Checking if a string ends with a specified substring
#s = $string.ends_with(#string,#substring[,mode])
If mode is set to lower, then both #string and #substring will be converted for the test to lowercase.
Example:
#t1= "Abcdghj.xxx" #t2=".xxx"
#s =$string.ends_with(#t1,#t2)
Result:
#s = 1 (true)

Convert string to lowercase
#s = $string.lower(#string)

Example:
#string = "ABCDabXY"
#s = $string.lower(#string)
Result: #s = abcdabxy

Convert substring to lowercase
#field = $string.lower_substring(#field,start[,length])

start - position in string (0,1,...)
length - number of symbols
If the length is not specified, then all characters are converted to lowercase from the specified position to the end of the line.
Example:
#field = ABCD
#field =$string.lower_substring(#field,1)
Result: #field = Abcd

Convert string to uppercase
#s = $string.upper(#string)

Example:
#string = "ABCDabXY"
#s = $string.lower(#string)
Result: #s = ABCDABXY

Convert substring to uppercase
#s = $string.upper_substring(#string,start[,length])

start - position in string (0,1,...)
length - number of symbols
If length is not specified, then all characters are converted touppercase from the specified position to the end of the line.

Example:
#string = abcdefgh
#s =$string.upper_substring(#string,0,2)
Result: #s = ABcdefgh

Convert first symbol to uppercase
#string = $string.first_upper(#string)

Example:
#string = aBC
#r =$string.first_upper(#string)
Result: #r = Abcd

Get length of string
#s = $string.length(#string)

Example:
#string = "ABCDabXY"
#s = $string.length(#string)
Result: #s = 8

Get start position of substring
#ind = $string.indexof(#string,#substring)

Example 1:
#string = "hello world"
#ind = $string.indexof(#string,"wo")
Result: #ind = 7
Example 2:
#string = "hello world"
#ind = $string.indexof(#string,"wa")
Result: #ind = -1

Get start position of n-substring
#ind = $position_n_substring(#string,#substring,n)

Example 1:
#string = "hello world, world"
#ind = $position_n_substring(#string,"wo",2)
Result: #ind = 13
Example 2:
#string = "hello world, world"
#ind = $position_n_substring(#string,"wo",3)
Result: #ind = -1

Email name check
#ret = $string.emailvalid(#string)

#ret = 0 email is not valid
#ret = 1 email is valid
Example 1:
#string = "hello@world."
#ret = $string.emailvalid(#string)
#ret = 0
Example 2:
#string = "hello@world.de"
Result: #ret = $string.emailvalid(#string)
#ret = 1

Remove all leading and trailing white-space characters from string
#string = $string.trim(#string)

Example:
#string = " hello world "
#string = $string.trim(#string)
Result: #string = "hello world"

Remove all leading white-space characters from the string
#string = $string.trim_start(#string)

Example:
#string = " hello world "
#string = $string.trim_start(#string)
Result: #string = "hello world "

Remove all trailing white-space characters from the string
#string = $string.trim_end(#string)

Example:
#string = " hello world "
#string = $string.trim_start(#string)
Result: #string = " hello world"

Remove all leading characters from the string
#string = $string.trim_leading_symbols(#string,"_")

Example:
#string = "___hello world"
#string = $string.trim_start(#string)
Result: #string = "hello world"

Remove all trailing characters from the string
#string = $string.trim_trailing_symbols(#string,".")

Example:
#string = "hello world........"
#string = $string.trim_end(#string,".")
Result: #string = "hello world"

Remove quotes
#string = $string.remove_quotes(#string)

Example:
#string: name="xxx"&pass="bb"
#string = $string.remove_quotes(#string)
Result: name=xxx&pass=bb

Remove first and last symbols
#string = $string.remove_first_last_symbols(#first,#string,#last)

Example:
#string = ""
#string = $string.remove_first_last_symbols("<",#string,">")
Result: name=xxx

Enclose strings in double_quotes
#string =$enclose_in_double_quotes(#text)

Example:
#text=123 45
#string =$enclose_in_symbols("<",#text,">")
Result: #string="123 45"

Enclose strings in symbols
#string =$enclose_in_symbols("<",#text,">")

Example:
#text="123 45"
#string =$enclose_in_symbols("<",#text,">")
Result: #string=<123 45>

Delete extention (all after point)
#string = $string.delete_extention(#string)

Example:
#string = 1234Hffd.png
#string = $string.delete_extention(#string)
Result: #string=1234Hffd

Add extention
#string = $string.add_extention(#string,#extention)

Example 1:
#string = 1234Hffd
#string = $string.add_extention(#string,"png")
Result: #string=1234Hffd.png
Example 2:
#string = 1234Hffd.png
#string = $string.add_extention(#string,"png")
Result: #string=1234Hffd.png

Reduce gups
#string = $string.reduce_gups(#string)

Example:
#string = " 1 2 3 "
#string = $string.reduce_gups(#string)
Result: #string=" 1 2 3 "

String contains substring
#result= $string.contains(#string,#substring)

Example:
#string = " abcdefgh"
#result = $string.contains(,#string,"k")
Result: #result= 0

Add leading symbols ( until length of string < n)
#string = $string.add_leading_symbols(#string,symbol,n)

Example:
#string = "1"
#string = $string.add_leading_symbols(#string,"0",2)
Result: #string="01"

Inserts a substring after a substring
#string = $string.insert_after_substr(#string,#after,#insert)

Example:
#string = "12356"
#after= "3"
#insert = "4"
#string = $string.insert_after_substr(#string,#index,#insert)
Result: #string="123456"

Inserts a substring at a index
#string = $string.insert_after_index(#string,#after,#insert)

Example:
#string = "12356"
#index = "2"
#insert = "4"
#string = $string.insert_after_index(#string,#after,#insert)
Result: #string="123456"


Add leading symbol
#string = $string.add_leading_symbol(#string,symbol)

Example:
#string = "1"
#string = $string.add_leading_symbol(#string,$)
Result: #string="$1"

Replace a substring with a substring
#string = $string.replace(#string, substr1, substr2)

Example:
#string = "abcdefghijkl"
#string = $string.replace(#string, "def". "DEF")
Result: #string="abcDEFghijkl"

Replace between two substrings
#string = $string.replace_between(#string, substr1, substr2,substring3)

Example:
#string = "111_abcdefghijkl_222"
#string = $string.replace_between(#string, "111". "222","ABC")
Result: #string="111_ABC_222"

Get number of substrings in a string
#counter = $string.number_of substring(#string, substring)

Example:
#string="the answer is the answer"
#counter = $string.number_of substring(#string, "the")
Result: #counter = 2

Dividing a string into parts by characters from a given string to a string
#string=$string.split_string_using_delimiter_to_string(#string, delimiter)

Example:
#string = "12345"
#string=$string.split_string_using_delimiter_to_string(#string,~coma)
Result: #string = "1,2,3,4,5"

Dividing a string into parts according to a given separator
#array = $string.split_string_using_delimiter_to_array(#string, delimiter)

Example:
#string = "the answer is the answer"
#array = $string.split_string_using_delimiter_to_array(#string, " ")
Result: #array = {the, answer,is, the,answer}

Dividing a string into parts by characters from a given string to array
#array = $string.split_string_use_list_delimiter_to_array(#string, string-delimiter)

Example:
#string = "x^2 +6x -55 =50"
#array = $string.split_string_use_list_delimiter_to_array(#string, "+=- ")
Result: #array = {x^2,+6x,-55,=50}

Create string with repeating
#string= $string.repeat(#string,N)

Example:
#res= $string.repeat("12345",5)
Result: #res = 1234512345123451234512345

String-reverse
#string= $string.reverse(#string)

Example:
#res= $string.reverse("12345")
Result: #res = 54321

MD5 encoding
#string= $string.md5(#string)

Example:
#res= $string.md5("12345")
Result: #res = 827ccb0eea8a706c4c34a16891f84e7b

Formatierung eines numerischen Felds
#res = $format(#field,format)

Example:
#string="12.5567"
#r = $format(#string,"99.999")
#r= 12.556

Computing from string
#string= $string.compute(#string)

Example:
#res= $string.compute("12+30/2")
Result: #res = 17

String encrypting & decrypting
#string=$encrypt(string, key)
#string=$decrypt(string, key)

Key is a secret key. It should be kept safe - if someone has your secret key, they can decrypt your data.
Example:
#string="12345"
#key="x"
// encrypting
#string2=$encrypt(#string,#key)
#string2 = KA1gub4QbRrE5wVkEjnmWw==
// decrypting
#string2=$decrypt(#string2,#key)
#string2 =12345

Insert a symbol after each symbol in a string
#string = $string.insert_separator(string,symbol)
Example:
#string="12345"
#separator="-"
#string3 = $string.insert_separator(#string,#separator)
#string3 = 1-2-3-4-5