vipsi - the built-in words
Author: kio@little-bat.de
Keywords: vipsi shell script interpreter programming

# vipsi - shell and script language

## the built-in words

### text (string) functions

functions which return text values.

#### name

        text = name variable

return name of variable.

e.g.:

        put "a[0] is named: ", name a[0], nl

#### string

        text = string number

convert number to text representation.

e.g.:

        string(47+11) = "58"

#### upperstr

        text = upperstr text

convert text to all uppercase characters. of course this works with all unicode characters.

e.g.

        upperstr("Hello World!") = "HELLO WORLD!"

#### lowerstr

        text = lowerstr text

convert text to all lowercase characters. of course this works with all unicode characters.

e.g.

        lowerstr("Hello World!") = "hello world!"

#### charstr

        text = charstr number

convert unicode character code (number) to character (text).

e.g.:

        charstr 8364 = "€"

#### hexstr

        text = hexstr ( number1 [, number2] )

convert number1 to hexadecimal digit string. resulting text is sized to fit or sized according to number2, truncating or padding 0's to the left.

e.g.:

        hexstr(240)   = "F0"
    	hexstr(240,4) = "00F0"
    	hexstr(240,1) = "0"

#### binstr

        text = binstr ( number1 [, number2] )

convert number1 to binary digit string. resulting text is sized to fit or sized according to number2, truncating or padding 0's to the left.

e.g.:

        binstr(10,8) = "00001010"; binstr(10,2) = "10"

#### substr

        text = substr ( text, number1, number2 )

return substring from index number1 to index number2 inclusive, resulting in number2-number1+1 characters.
indexes start at 1.

functionally equivalent to `text[number1 to number2]`.

e.g.:

        substr ( "1234567890", 3, 6 )  =  "3456"
        substr ( "1234567890", 8, 99 ) =  "890"
        substr ( "1234567890", 8, 4 )  =  ""

#### midstr

        text = midstr ( text, number1 [, number2] )

return substring starting at index number1 and including the next number2 characters. if the length number2 is omitted, then return all text up to text end.
indexes start at 1.

e.g.:

        midstr ( "1234567890", 3, 4 )  =  "3456"
        midstr ( "1234567890", 8, 99 ) =  "890"
        midstr ( "1234567890", 5 )     =  "567890"
        midstr ( "1234567890", 8, -4 ) =  ""

#### leftstr

        text = leftstr ( text, number )

return substring consisting of number bytes from the left side of the text.
indexes start at 1.

functionally equivalent to `text[to number]`.

e.g.:

        leftstr ( "1234567890", 3 )  =  "123"
        leftstr ( "1234567890", 99 ) =  "1234567890"
        leftstr ( "1234567890", -5 ) =  ""

#### rightstr

        text = rightstr ( text, number )

return substring consisting of number bytes from the right side of the text.

e.g.:

        rightstr ( "1234567890", 3 )  =  "890"
        rightstr ( "1234567890", 99 ) =  "1234567890"
        rightstr ( "1234567890", -5 ) =  ""

#### datestr

        text = datestr number

convert numeric date format to readable text.

e.g.:

        datestr 0 = "1970-01-01 01:00:00"

#### fullpath

        text = fullpath text

get full, absolute path for partial path. expands "./" and "../", symbolic links, "~" and relative path to the absolute file or directory path.

#### file

    (1) text = file filename
    (2) file filename = text

(1) read file filename in binary mode. returns a text value. all character codes are in range 0 ... 255. you should convert character encoding afterwards manually with function convert.

(2) write text to file filename in binary mode. all character codes should be in range 0 ... 255 or they are chopped losing some information. you should convert character encoding beforehand manually with function convert.