inStr
returns the first position of an search value of an string
Syntax:inStr(startpos, string, searchvalue, compare)
compare: 0 ... binary comparison 1 ... textual comparison
Example:
searchstring="this is an searchtext"
position=instr(1,searchstring, is, 0)
wscript.echo position
Output:
3 ("is" is first found on the 3rd position)
Example2:
searchstring="this is an searchtext"
position=instr(4,searchstring, is, 0)
wscript.echo position
Output:
6 (beginning to search on position 4, "is" is found on the 6th position)
inStrRev
same as instr beginning the search at the end of an String
Example:
searchstring="this is an searchtext"
position=InStrRev(searchstring, "is")
wscript.echo position
Output:6
replace
returns characters from the center of an string,
Syntax:mid(string, search, replacewith)
Example:wscript.echo replace("HExxO","xx","LL")
Output:HELLO (beginning at character 2, 3 characters long)
strcomp
compares to strings
Syntax:strcomp(string, search, replacewith)
Example:wscript.echo strcomp("Hello","Hello")
Output:0 (0 means the strings are identical)
Example2:wscript.echo strcomp("Hello","Helloxxx")
Output:-1 (-1 means the value of "Hello" is smaller then "Helloxxx")
Example3:wscript.echo strcomp("60","40")
Output:-1 (1 means the value "60" is higher then "40")
LCase
converts a string to lowercase
Example:wscript.echo lcase("HELLO")
Output:hello
UCase
converts a string to uppercase
Example:wscript.echo ucase("hello")
Output:HELLO
Left
returns a specified number of characters beginning from the beginning of an string
Example:wscript.echo left("HELLO",2)
Output:HE
Right
returns a specified number of characters beginning from the end of an string
Example:wscript.echo right("HELLO",2)
Output:LO
Len
returns the number of characters in a string
Example:wscript.echo len("HELLO")
Output:5
Right Part of a string
combining instrrev and right:
returns the the right part of an string beginning from a specific searchstring
Example:var="this_is_a_string"
search="_"
result=right (var, len(var)-instrrev (var, search))
wscript.echo result
Output:string
Left Part of a string
combining instr and left:
returns the the left part of an string ending at a specific searchstring
Example:
var="this_is_a_string"
search="_"
result=left (var, instr(var, search)-1)
wscript.echo result
Output:this
Ltrim
deletes spaces on the left side of a string
Example:wscript.echo ltrim(" HELLO")
Output:HELLO
Rtrim
deletes spaces on the end of a string
Example:wscript.echo ltrim("HELLO ")
Output:HELLO
trim
deletes spaces on both ends of an string
Example:wscript.echo ltrim(" HELLO ")
Output:HELLO
mid
returns characters from the center of an string,
Syntax:mid(string, startpos, lengh_of_the_returning_string)
Example:wscript.echo mid("HELLO",2,3)
Output:ELL (beginning at character 2, 3 characters long)
Mid Part of a string
combining instr, instrrev and mid:
returns the the middle part of an string beginning with a searchsting and ending at an other searchstring
Example:
var="this_is_a-string"
searchleft="_"
searchright="-"
result=mid (var, instr(var, searchleft)+1, instrrev(var, searchright)-instr(var, searchleft)-1)
wscript.echo result
Output:is_a
(take a look at the split function, maybe it fits better to your needs) : Array Funktions
strreverse
reverses an string
Example:wscript.echo strreverse("HELLO")
Output:OLLEH
space
returns a defined number of spaces
Example:wscript.echo space("10")
Output:" " (10 spaces)
string
types an defined string the number of times you select
Example:wscript.echo string(10,"x")
Output:xxxxxxxxxx