-
The following code sets the value of a string.
myString = "Thank God It's Monday"
-
Escape double quotes by two pairs of double quotes
"Eric said: ""That's a great car!"""
-
Access a specific character within a string; returns: a
mySpecialChar = myString(2)
-
Retrieve the starting index of the string; returns: 6
myIndex = myString.IndexOf("God")
-
Retrieves a substring by specifying starting index & length; returns: God
mySubstring = myString.Substring(6, 3)
-
Replace the first input parameter with the second; returns: Thank God It's Friday
myReplacedString = myString.Replace("Monday", "Friday")
-
Remove white spaces at the beginning & end of a string
myTrimmedString = myString.Trim()
-
Changes all characters to lower case letters; returns: thank god it's Monday
myStringLowerCase = myString.ToLower()
-
Changes all characters to upper case letters; returns: THANK GOD IT'S MONDAY
myStringUpperCase = myString.ToUpper()