DWS String Library

Top  Previous  Next  Contents  Index 

The following string functions are supported in DWS scripts.  Most are standard DWS string functions, while some were added by Ascendis Software LLC:

 

function AnsiCompareStr(<string1>, <string2>): Integer;

compares two strings and returns 0 if they are equal
returns > 0 if first string is greater than second string
returns < 0 if first string is less than second string
case sensitive
uses current locale

 

function AnsiCompareText(<string1>, <string2>): Integer;

compares two strings and returns 0 if they are equal
returns > 0 if first string is greater than second string
returns < 0 if first string is less than second string
not case sensitive
uses current locale

 

function AnsiLowerCase(<string>): String;

converts letters in <string> to lowercase using the current locale
<string> can include multi-byte characters

 

function AnsiSameStr(<string1>, <string2>): Boolean;

compares two strings and returns True if they are equal
case sensitive
uses current locale

 

function AnsiSameText(<string1>, <string2>): Boolean;

compares two strings and returns True if they are equal
not case sensitive
uses current locale

 

function AnsiUpperCase(<string>): String;

converts letters in <string> to uppercase using the current locale
<string> can include multi-byte characters

 

function BoolToStr(<boolean>): String;

returns "True" or "False" depending on <boolean>

 

function CharAt(<string>, <index>): String;

returns character at <index> in <string>

 

function Chr(<0-255>): String;

converts passed character code into the corresponding character

 

function CompareStr(<string1>, <string2>): Integer;

compares two strings and returns 0 if they are equal
returns > 0 if first string is greater than second string
returns < 0 if first string is less than second string
case sensitive
ignores current locale

 

function CompareText(<string1>, <string2>): Integer;

compares two strings and returns 0 if they are equal
returns > 0 if first string is greater than second string
returns < 0 if first string is less than second string
not case sensitive
ignores current locale

 

function Contains(<where to find string>, <what to find string>): Boolean;

returns True if <what to find string> is in <where to find string>, or False

 

function ContainsText(<where to find string>, <what to find string>): Boolean;

returns True if <what to find string> is in <where to find string>, or False
not case sensitive

 

function Copy(<string>, <index>, <length>): String;

copies <length> characters from <string> starting at <index>

 

procedure Delete(<string>, <index>, <length>);

deletes <length> characters from <string> starting at <index>

 

function EndsWith(<s>, <findStr>): Boolean;

returns True if <s> ends with <findStr>; else False

 

function FloatToStr(<float>): String;

converts passed floating point number into a string

 

procedure Insert(<insert>, var <string>, <insert>);

inserts <insert> into <string> at <index>

 

function IntToHex(<integer>, <min digits>): String;

converts passed integer into a hexadecimal string
<min digits> specifies the minimum number of digits in the result

 

function IntToStr(<integer>): String;

converts passed integer into a string

 

function IPos(<what to find string>, <where to find string>): Integer;

returns location of <what to find string> in <where to find string>, or zero
not case sensitive

 

function IsDelimiter(<delimiters string>, <string>, <index>): Boolean;

returns True if character at <index> in <string> is found in <delimiters string>

 

function LastDelimiter(<delimiters string>, <string>): Integer;

returns index in <string> of last delimiter from <delimiters string>, or 0

 

function LeftStr(<string>, <length>): String;

copies first <length> characters from <string>

 

function Length(<string>): String;

returns number of characters in <string>

 

function LowerCase(<string>): String;

converts letters in <string> to lowercase

 

function MidStr(<string>, <index>, <length>): String;

copies <length> characters from <string> starting at <index>

 

function Ord(<character>): Integer;

converts passed character into a corresponding character code

 

function Pos(<what to find string>, <where to find string>): Integer;

returns location of <what to find string> in <where to find string>, or zero

 

function QuotedStr(<string>): String;

returns <string> surrounded by single quotes
single quotes already in <string> are repeated

 

function RightStr(<string>, <length>): String;

copies last <length> characters from <string>

 

procedure SetCharAt(var <string>, <index>, <character>);

changes character at <index> in <string> to <character>

 

procedure SetLength(var <string>, <length>);

changes length of <string> to <length>

 

function StartsWith(<s>, <findStr>): Boolean;

returns True if <s> starts with <findStr>; else False

 

function StringOfChar(<character>, <length>): String;

returns string of <length> <characters>

 

function StringReplace(<s>, <oldPattern>, <newPattern>, <replaceAll>, <ignoreCase>): String;

returns <s> with <oldPattern> changed to <newPattern>
if <replaceAll> is True, all instances of <oldPattern> will be replaced; otherwise only the first one will be replaced
if <ignoreCase> is True, case differences between <s> and <oldPattern> will be ignored

 

function StrToFloat(<string>): Float;

converts passed string into a floating point number

 

function StrToFloatDef(<string>, <default value>): Float;

converts passed string into a floating point number
returns <default value> if <string> cannot be converted

 

function StrToInt(<string>): Integer;

converts passed string into an integer

 

function StrToIntDef(<string>, <default value>): Integer;

converts passed string into an integer
returns <default value> if <string> cannot be converted

 

function Trim(<string>): String;

removes leading and trailing whitespace from <string>

 

function TrimLeft(<string>): String;

removes leading whitespace from <string>

 

function TrimRight(<string>): String;

removes trailing whitespace from <string>

 

function UpperCase(<string>): String;

converts letters in <string> to uppercase