The class StringAssistant provides static methods to manipulate stings.

Method Description
escapeSpecialCharacters() Strips special characters that can be problematical during saving data to a database or while displaying them in form controls.
replaceSpecialCharacters() Replaces characters that are not allowed for files names and returns a sanitized string.
encodeCharactersToHTML() Encodes a string into HTML entities.
generateCaptchaString() Generates a string, that can be used as a captcha check string.

Using the above methods is as follows:

PHP code
use APF\tools\string\StringAssistant; $sanitizedString = StringAssistant::escapeSpecialCharacters($_REQUEST['some-parameter']); $captchaChallenge = StringAssistant::generateCaptchaString(5); $entityEncoded = StringAssistant::encodeCharactersToHTML('');


Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.

In order to provide a state-of-the-art web experience and to continuously improve our services we are using cookies. By using this web page you agree to the use of cookies. For more information, please refer to our Privacy policy.