Home > Language Reference > Functions > Strings

BuildURL Function

Builds an URL from a base address, a path and a filename.

Syntax

Public Function BuildURL(ByRef sBaseURL As String, ByRef sRelativeURL As String) As String

ParameterDescription
sBaseURLBase address.
sRelativeURLPath and file name.

Remarks

The BuildURL function builds a full URL from a base address, a relative path and a filename. It does not check however that each of these parameters is valid; if the base URL is malformed for example, the returned URL will be malformed as well.

The sBaseURL parameter is the base URL. Usually it will contain a protocol, a domain name and possibly a path. For example, it could be "http://www.handheld-basic/forum". The sRelativeURL is the relative path and file name to append to the base URL. Special character sequences such as "./" or "../" are properly interpreted.

For example:

Private Sub Button1_Click()
  MsgBox BuildUrl("http://www.handheld-basic.com","index.php")
  MsgBox BuildUrl("http://www.handheld-basic.com","/index.php")
  MsgBox BuildUrl("http://www.handheld-basic.com/forum","../index.php")
End Sub

All these calls will display the same string, namely "http://www.handheld-basic.com/index.php".

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A