Programming Quick Guide:
String Manipulation
8
Upper and lower
The upper and lower function changes a string to all lowercase or all uppercase.
This is very handy when validating answers as some people may add a capital letter to the start of a string and some may not.
2
2
Substring
3
The Substring function is used to get part of a string. The function take to arguments (A starting point and end point).
The start and end are both index values so the first letter of the string has an index value of 0.
Remove white spaces (Strip)
4
The Stripfunction is used to remove all white spaces BUT only at the start and end of a string.
This is useful when getting inputs from a user as some people add a space at the end by mistake.
Replace
5
The Replace function allow one letter to be replaced by another. The first argument is the letter to be replaced (in the example this is H) with the second being the letter to replace it (in this case J)
By having quote with nothing inside (“”) this will replace the chosen letter with nothing. This can be used to remove all spaces.
Split
6
The split function allows a string to be split into multiple string which are then stored into a list. It takes an argument of where to split (in this case on the comma). Wants the list is created it is up the programmer on how they want to use the list. (in this case I have used a loop to print the contents.)