# TCCConversion_Functions

#### Purpose

This module supports string conversions

#### Module Parameters

-

#### Module depends on

-

Summary

TCCConversion_Functions | This module supports string conversions
Functions |
f_putInLowercase | Put charstring to lowercase
f_putInUppercase | Put charstring to uppercase
f_unichar2charstr | Convert universal charstring 2 charstring
f_charstr2unichar | Convert charstring 2 universal charstring
f_replaceFirstOccurenceOfSubstring | Replace first occurance of parSubStrA with parSubStrB in parInStr
f_replaceEveryOccurenceOfSubstring | Replace every occurance of parSubStrA with parSubStrB in parInStr
f_replaceFirstOccurenceOfPattern | Replace first occurance of pattern parSubStrA with parSubStrB in parInStr
f_replaceEveryOccurenceOfPattern | Replace every occurance of pattern parSubStrA with parSubStrB in parInStr
f_addOctetstring | Add two integer values represented in OCTETSTRING
f_subOctetstring | Substract two integer values represented in OCTETSTRING
f_compOctetstring | Compare two integer values represented in OCTETSTRING
f_substr_token | The function returns a substring from a value.
f_strstr | The f_strstr function locates the first occurrence of the string s2 in string s1 and returns an index of starting pont of the located string, or -1 if the string is not found.
f_OctetIpv4 | convertes an IPv4 address given in dotted notation to its hex representation
f_convertIPAddrToBinary | Converts an IPv4 and IPv6 address to its hex representation.
f_oct2char_safe | Fault tolerant version of the oct2str Titan built-in function.

### Functions

### f_putInLowercase

> external function f_putInLowercase( | charstring | pl_string | ) return charstring

#### Purpose

Put charstring to lowercase

#### Parameters

pl_string | in charstring - charstring

#### Return Value

charstring | converted value

#### Errors

-

#### Detailed description

-

### f_putInUppercase

> external function f_putInUppercase( | charstring | pl_string | ) return charstring

#### Purpose

Put charstring to uppercase

#### Parameters

pl_string | in charstring - charstring

#### Return Value

charstring | converted value

#### Errors

-

#### Detailed description

-

### f_unichar2charstr

> function f_unichar2charstr (
> | in universal | charstring | p_unichar
> ) return charstring

#### Purpose

Convert universal charstring 2 charstring

#### Parameters

p_unichar | in charstring - unichar 2 convert

#### Return Value

charstring | converted value

#### Errors

-

#### Detailed description

-

### f_charstr2unichar

> function f_charstr2unichar ( | in | charstring | p_char | ) return universal charstring

#### Purpose

Convert charstring 2 universal charstring

#### Parameters

p_char | in charstring - char 2 convert

#### Return Value

universal charstring | converted value

#### Errors

-

#### Detailed description

-

### f_replaceFirstOccurenceOfSubstring

> function f_replaceFirstOccurenceOfSubstring(
> | in charstring | parInStr | ,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

#### Purpose

Replace first occurance of parSubStrA with parSubStrB in parInStr

#### Parameters

parInStr | in charstring - input string
parSubStrA | in charstring - string to replace
parSubStrB | in charstring - string to replace with

#### Return Value

charstring | modified input string

#### Errors

-

#### Detailed description

-

### f_replaceEveryOccurenceOfSubstring

> function f_replaceEveryOccurenceOfSubstring(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

#### Purpose

Replace every occurance of parSubStrA with parSubStrB in parInStr

#### Parameters

parInStr | in charstring - input string
parSubStrA | in charstring - string to replace
parSubStrB | in charstring - string to replace with

#### Return Value

charstring | modified input string

#### Errors

-

#### Detailed description

-

### f_replaceFirstOccurenceOfPattern

> function f_replaceFirstOccurenceOfPattern(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

#### Purpose

Replace first occurance of pattern parSubStrA with parSubStrB in parInStr

#### Parameters

parInStr | in charstring - input string
parSubStrA | in charstring - pattern to replace
parSubStrB | in charstring - string to replace with

#### Return Value

charstring | modified input string

#### Errors

-

#### Detailed description

-

### f_replaceEveryOccurenceOfPattern

> function f_replaceEveryOccurenceOfPattern(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

#### Purpose

Replace every occurance of pattern parSubStrA with parSubStrB in parInStr

#### Parameters

parInStr | in charstring - input string
parSubStrA | in charstring - string to replace
parSubStrB | in charstring - string to replace with

#### Return Value

charstring | modified input string

#### Errors

-

#### Detailed description

-

### f_addOctetstring

> external function f_addOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return octetstring

#### Purpose

Add two integer values represented in OCTETSTRING

#### Parameters

par1 | in octetstring - first octetstring value
par2 | in octetstring - second octetstring value

#### Return Value

octetstring | sum of input

#### Errors

-

#### Detailed description

Negative values are unhandled!

### f_subOctetstring

> external function f_subOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return octetstring

#### Purpose

Substract two integer values represented in OCTETSTRING

#### Parameters

par1 | in octetstring - first octetstring value
par2 | in octetstring - second octetstring value

#### Return Value

octetstring | difference of input

#### Errors

-

#### Detailed description

Negative values are unhandled!

### f_compOctetstring

> external function f_compOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return integer

#### Purpose

Compare two integer values represented in OCTETSTRING

#### Parameters

par1 | in octetstring - first octetstring value
par2 | in octetstring - second octetstring value

#### Return Value

integer | 0: par1 = par2 1: par1>par2 2: par1<par2

#### Errors

-

#### Detailed description

Negative values are unhandled!

### f_substr_token

> external function f_substr_token( | in | charstring | str,
> | in | charstring | begin_token,
> | in | charstring | end_token | ) return charstring

#### Purpose

The function returns a substring from a value. The starting and the ending points are defined by the begin and end tokens.

#### Parameters

str | in charstring - the value
begin_token | in charstring - begin token
end_token | in charstring - end token

#### Return Value

charstring. If one of the tokens is not found it returns an empty string

#### Errors

-

#### Detailed description

If end_token is an empty string the function returns the part of the value after the begin_token. If begin_token is an empty string the function returns the part of the value until the end_token. If both of them empty string the function returns the part whole value

### f_strstr

> external function f_strstr( | in | charstring | s1, |
> | in | charstring | s2, |
> | in | integer | offset: | = | ) return integer

#### Purpose

The f_strstr function locates the first occurrence of the string s2 in string s1 and returns an index of starting pont of the located string, or -1 if the string is not found. If s2 is an empty, the func- tion returns 0.

#### Parameters

s1 | in charstring - input string
s2 | in charstring - string to search
offset | in integer - start offset.

#### Return Value

index of starting pont of the located string

#### Errors

-

#### Detailed description

The offset determines the starting point of the search. Any occurance of the s2 before the offset is ignored. The offset is optional

### f_OctetIpv4

> function f_OctetIpv4( | in | charstring | pl_ip | ) return octetstring

#### Purpose

convertes an IPv4 address given in dotted notation to its hex representation

#### Parameters

pl_ip | in charstring - input string

#### Return Value

hex value of the Ip in an octetstring

#### Errors

-

#### Detailed description

type record of integer IntegerList;

### f_convertIPAddrToBinary

> external function f_convertIPAddrToBinary(
> | in | charstring | pl_ip
> ) return octetstring

#### Purpose

Converts an IPv4 and IPv6 address to its hex representation. IPv6 address is assumed if the input string contains ‘:’

#### Parameters

pl_ip | in charstring - input string

#### Return Value

hex value of the Ip in an octetstring

#### Errors

-

#### Detailed description

### f_oct2char_safe

> external function f_oct2char_safe( | in | octetstring | par1,
> | out | charstring | par2 | ) return boolean

#### Purpose

Fault tolerant version of the oct2str Titan built-in function.

#### Parameters

s1 | in octetsttring - input string
s2 | out charstring - output string

#### Return Value

false on fault, ie. on unbound input or invalid character in input. true on success

#### Errors

-

#### Detailed description

On fault, the longest chunk that could be decoded is returned.

> external function f_putInLowercase( | charstring | pl_string | ) return charstring

Put charstring to lowercase

> external function f_putInUppercase( | charstring | pl_string | ) return charstring

Put charstring to uppercase

> function f_unichar2charstr (
> | in universal | charstring | p_unichar
> ) return charstring

Convert universal charstring 2 charstring

> function f_charstr2unichar ( | in | charstring | p_char | ) return universal charstring

Convert charstring 2 universal charstring

> function f_replaceFirstOccurenceOfSubstring(
> | in charstring | parInStr | ,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

Replace first occurance of parSubStrA with parSubStrB in parInStr

> function f_replaceEveryOccurenceOfSubstring(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

Replace every occurance of parSubStrA with parSubStrB in parInStr

> function f_replaceFirstOccurenceOfPattern(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

Replace first occurance of pattern parSubStrA with parSubStrB in parInStr

> function f_replaceEveryOccurenceOfPattern(
> | in | charstring | parInStr,
> | in | charstring | parSubStrA,
> | in | charstring | parSubStrB
> ) return charstring

Replace every occurance of pattern parSubStrA with parSubStrB in parInStr

> external function f_addOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return octetstring

Add two integer values represented in OCTETSTRING

> external function f_subOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return octetstring

Substract two integer values represented in OCTETSTRING

> external function f_compOctetstring( | in | octetstring | par1,
> | in | octetstring | par2 | ) return integer

Compare two integer values represented in OCTETSTRING

> external function f_substr_token( | in | charstring | str,
> | in | charstring | begin_token,
> | in | charstring | end_token | ) return charstring

The function returns a substring from a value.

> external function f_strstr( | in | charstring | s1, |
> | in | charstring | s2, |
> | in | integer | offset: | = | ) return integer

The f_strstr function locates the first occurrence of the string s2 in string s1 and returns an index of starting pont of the located string, or -1 if the string is not found.

> function f_OctetIpv4( | in | charstring | pl_ip | ) return octetstring

convertes an IPv4 address given in dotted notation to its hex representation

> external function f_convertIPAddrToBinary(
> | in | charstring | pl_ip
> ) return octetstring

Converts an IPv4 and IPv6 address to its hex representation.

> external function f_oct2char_safe( | in | octetstring | par1,
> | out | charstring | par2 | ) return boolean

Fault tolerant version of the oct2str Titan built-in function.