JCL Help:StrEnsurePrefix@AnsiString@AnsiString

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Forces Text to start with Prefix.


Pascal

 function StrEnsurePrefix(const Prefix: string; const Text: string): string;
function StrEnsurePrefix(const Prefix: AnsiString; const Text: AnsiString): AnsiString;


Parameters

Parameters Description
const Prefix: string The prefix to test for and apply.
const Text: string The string which must be forced to have a prefix.


Return Value

The function result is a copy of the supplied Text, prefixed with Prefix.


Description

StrEnsurePrefix tests whether the supplied text start with the supplied prefix. If it doesn't then the prefix is prepended to the string otherwise the function does nothing. Note that if Text is an empty string then the result will be Prefix.


See Also

StrEnsureNoPrefix StrEnsureSuffix


About

Unit

JclAnsiStrings


Donator

Nick Hodges


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page