Manipulation of String: 
InStr(), LCase(), Left(), Len(), LenB(), LTring(), Mid(), Replace(), Right(), RTrim(), Space (), String(), StrReverse(), Trim()UCase()

LCase(string) and UCase(string) Changes to lower case or to upper case
TheString="AbCdEfGhIjKlMnOpQrStUvWxYz"
LCase: <% =LCase("AbCdEfGhIjKlMnOpQrStUvWxYz") %>
UCase: <% =UCase("AbCdEfGhIjKlMnOpQrStUvWxYz") %>
Original: AbCdEfGhIjKlMnOpQrStUvWxYz
LCase: abcdefghijklmnopqrstuvwxyz
UCase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
InStr(string, string1)  Position of string1 within string. See also Compare strings
TheString="My cat is very nice"<% TheString="My cat is very nice" %>

Location of cat within TheString?
InStr(TheString,"cat"): <% =InStr(TheString,"cat") %>

very?
InStr(TheString,"very"): <% =InStr(TheString,"very") %>

nice?
InStr(TheString,"nice"): <% =InStr(TheString,"nice") %>

dog?
InStr(TheString,"dog"): <% =InStr(TheString,"dog") %>

CAT?
InStr(TheString,"CAT"): <% =InStr(TheString,"CAT") %>

String: "My cat is very nice"

cat?
InStr(TheString,"cat"): 4

very?
InStr(TheString,"very"): 11

nice?
InStr(TheString,"nice"): 16

dog?
InStr(TheString,"dog"): 0

CAT?
InStr(TheString,"CAT"): 0

Len(string) and LenB(string)  Length of string (number or character or bytes)
<pre>
Number of characters in a string

Len("0123456789"): <% =Len("0123456789") %>
Len("My cat is very nice"): <% =Len("My cat is very nice") %>
Len("AbCdEfGhIjKlMnOpQrStUvWxYz"): <% =Len("AbCdEfGhIjKlMnOpQrStUvWxYz") %>

For numbers will indicate number of bytes required by store number

Len (1): <% =Len(1) %>
Len (10): <% =Len(10) %>
Len (100): <% =Len(100) %>
Len (100.01): <% =Len(100.01) %>

Number of bytes to store a string

LenB("0123456789"): <% =LenB("0123456789") %>
LenB("My cat is very nice"): <% =LenB("My cat is very nice") %>
LenB("AbCdEfGhIjKlMnOpQrStUvWxYz"): <% =LenB("AbCdEfGhIjKlMnOpQrStUvWxYz") %>
</pre>

Number of characters in a string

Len("0123456789"): 10
Len("My cat is very nice"): 19
Len("AbCdEfGhIjKlMnOpQrStUvWxYz"): 26

For numbers will indicate number of bytes required by store number

Len (1): 1
Len (10): 2
Len (100): 3
Len (100.01): 6

Number of bytes to store a string

LenB("0123456789"): 20
LenB("My cat is very nice"): 38
LenB("AbCdEfGhIjKlMnOpQrStUvWxYz"): 52

Replace(string,string1,string2)  Replace string1 by string2 within string
<pre>
String: "My cat is very nice"

Change "cat" to "dog"
Replace("My cat is very nice","cat", "dog"): <% =Replace("My cat is very nice","cat", "dog") %>
</pre>

String: "My cat is very nice"

Change "cat" to "dog"
Replace("My cat is very nice","cat", "dog"): My dog is very nice

Right(string,number), Left(string,number), Mid(string,number,number)  Obtains substrings from string
<pre>
Original: 1234567890

Right("1234567890",2): <% =Right ("1234567890",2) %>
Right("1234567890",5): <% =Right ("1234567890",5) %>

Left("1234567890",2): <% =Left ("1234567890",2) %>
Left("1234567890",5): <% =Left ("1234567890",5) %>

Mid("1234567890",5,1): <% =Mid("1234567890",5,1) %>
Mid("1234567890",5,2): <% =Mid("1234567890",5,2) %>
Mid("1234567890",2,4): <% =Mid("1234567890",2,4) %>
Mid("1234567890",1,6): <% =Mid("1234567890",1,6) %>
</pre>

Original: 1234567890

Right("1234567890",2): 90
Right("1234567890",5): 67890

Left("1234567890",2): 12
Left("1234567890",5): 12345

Mid("1234567890",5,1): 5
Mid("1234567890",5,2): 56
Mid("1234567890",2,4): 2345
Mid("1234567890",1,6): 123456

Space (number)  Inserts spaces
<pre>
10: X<% =Space (10) %>X
15: X<% =Space (15) %>X
20: X<% =Space (20) %>X
</pre>
10: X          X
15: X               X
20: X                    X
String(number,string) Repeat the string the number of times indicated
<pre>
10: <% =String (10,"a") %>
15: <% =String (15,"a") %>
20: <% =String (20,"a") %>
</pre>
10: aaaaaaaaaa
15: aaaaaaaaaaaaaaa
20: aaaaaaaaaaaaaaaaaaaa
StrReverse(string) Reverse order of string
<pre>
Returns string with characters in reverse order

StrReverse("0123456789"): <% =StrReverse("0123456789") %>
StrReverse("AbCdEfGhIjKlMnOpQrStUvWxYz"): 
<% =StrReverse("AbCdEfGhIjKlMnOpQrStUvWxYz") %>

</pre>

Returns string with characters in reverse order

StrReverse("0123456789"): 9876543210
StrReverse("AbCdEfGhIjKlMnOpQrStUvWxYz"): 
zYxWvUtSrQpOnMlKjIhGfEdCbA

Trim(string), LTrim(string), RTrim(string)  Eliminates spaces in the left, right or both sites
<pre>
Trim: X<% =Trim ("     sss    ") %>X
LTrim: X<% =LTrim ("     sss    ") %>X
RTrim: X<% =RTrim ("     sss    ") %>X
</pre>
Trim: XsssX
LTrim: Xsss    X
RTrim: X     sssX

 

AspTutorial.info.