Null-terminated string (PChar) routines.

This chapter describes the STRINGS unit for Free Pascal. This unit is system independent, and therefore works on all supported platforms.

Allocate memory for a new null-terminated string on the heap StrAlloc reserves memory on the heap for a string with length Len, terminating #0 included, and returns a pointer to it. If there is not enough memory, a run-time error occurs. . Concatenate 2 null-terminated strings. Attaches Source to Dest and returns Dest. No length checking is performed. Compare 2 null-terminated strings, case sensitive.

Compares the null-terminated strings S1 and S2. The result is

  • A negative Longint when S1<S2.
  • 0 when S1=S2.
  • A positive Longint when S1>S2.

For an example, see .

None.
Copy a null-terminated string Copy the null terminated string in Source to Dest, and returns a pointer to Dest. Dest needs enough room to contain Source, i.e. StrLen(Source)+1 bytes. No length checking is performed. disposes of a null-terminated string on the heap Removes the string in P from the heap and releases the memory. None. Copy a null-terminated string, return a pointer to the end. Copies the Null-terminated string in Source to Dest, and returns a pointer to the end (i.e. the terminating Null-character) of the copied string. No length checking is performed. Return a pointer to the end of a null-terminated string Returns a pointer to the end of P. (i.e. to the terminating null-character. None. Compare 2 null-terminated strings, case insensitive.

Compares the null-terminated strings S1 and S2, ignoring case. The result is

  • A negative Longint when S1<S2.
  • 0 when S1=S2.
  • A positive Longint when S1>S2.
None.
Concatenate 2 null-terminated strings, with length boundary. Adds MaxLen characters from Source to Dest, and adds a terminating null-character. Returns Dest. None. Compare limited number of characters of 2 null-terminated strings

Compares maximum L characters of the null-terminated strings S1 and S2. The result is

  • A negative Longint when S1<S2.
  • 0 when S1=S2.
  • A positive Longint when S1>S2.
None.
Copy a null-terminated string, limited in length. Copies MaxLen characters from Source to Dest, and makes Dest a null terminated string. No length checking is performed. Length of a null-terminated string. Returns the length of the null-terminated string P. None. Compare limited number of characters in 2 null-terminated strings, ignoring case.

Compares maximum L characters of the null-terminated strings S1 and S2, ignoring case. The result is

  • A negative Longint when S1<S2.
  • 0 when S1=S2.
  • A positive Longint when S1>S2.

For an example, see

None.
Convert null-terminated string to all-lowercase. Converts P to an all-lowercase string. Returns P. None. Move a null-terminated string to new location. Copies MaxLen characters from Source to Dest. No terminating null-character is copied. Returns Dest None. Allocate room for new null-terminated string. Copies P to the Heap, and returns a pointer to the copy. Returns Nil if no memory was available for the copy. Convert a null-terminated string to a shortstring. Converts a null terminated string in P to a Pascal string, and returns this string. The string is truncated at 255 characters. None. Copy a pascal string to a null-terminated string Converts the Pascal string in Source to a Null-terminated string, and copies it to Dest. Dest needs enough room to contain the string Source, i.e. Length(Source)+1 bytes. No length checking is performed. Search for a null-terminated substring in a null-terminated string Returns a pointer to the first occurrence of S2 in S1. If S2 does not occur in S1, returns Nil. None. Find last occurrence of a character in a null-terminated string.

Returns a pointer to the last occurrence of the character C in the null-terminated string P. If C does not occur, returns Nil.

For an example, see .

None.
Find first occurrence of a character in a null-terminated string. Returns a pointer to the first occurrence of the character C in the null-terminated string P. If C does not occur, returns Nil. None. Convert null-terminated string to all-uppercase

Converts P to an all-uppercase string. Returns P.

For an example, see

None.