[<< wikibooks] A-level Computing 2009/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Fundamentals of Programming/Built-in functions
```You need to be familiar with several programming routines that come built into most common programming languages. These routines are very useful and should save you a lot of effort in writing code to perform common tasks. You might be asked to use them in the exam so learn them!

== Arithmetic functions ==
You'll have to be familiar with several

=== Round ===
The round function is used to round numbers to a limited number of decimal places using the Math.Round() function

=== Truncation ===
The truncate function returns the integer part of a number, regardless of the decimal places.

This is particularly useful when you are trying to perform DIV in modular arithmetic.

== String handling functions ==

=== Length ===
This function is used to find the length of any string you pass it, counting all the characters, including the spaces. In visual basic to find the length of a string we use the Len("some string") function that returns the integer length of the string that it has been passed:

=== Position ===
This function allows us to find the position of an item within a given string and returns the position's location. In visual basic this is performed by the following command:
InStr([string], [item])
For example we might want to find the location of an end of a sentence by looking for a fullstop:

We can also use this command to search for strings within strings. For example if we were to look for to see if a sentence contained a certain name:

If the search item is not contained in the string then it will return 0

=== Substring ===
This function allows you to snip items out of a string and return a substring. Visual Basic uses the following command:
[string].Substring([startPosition],[lengthOfReturnString]).
For example we might want to find the local number from a landline phone number we have been given. We'll have to ignore the area code:

=== Concatenation ===
This function allows you to stick strings together (concatenate) so that you can start to build strings using variables. Visual Basic uses the following command:
[stringA & stringB]
For example we might have a users name stored in a variable dim name as string and a greeting that we would like to give them:

=== String conversion functions ===
When you declare a variable you give it a datatype. This datatype restricts the values that you can place into the variable. For example:

dim age as integer
would allow: age = 34
would NOT allow: age = "cabbages"This seems to make sense, but what would happen when you try to place a real number into a integer:

This might seem OK, but in other lanuages we might run into trouble. To perform this we would have to convert from one datatype to another:

to/from integer, real, date/time.```