Package DE_EPAGES::Core::API::String
String manipulation functions
@EXPORT_OK |
Functions
- CompareStrings
- ConvertNewlines
- DecodeStructure
- EncodeNonISO1Chars
- EncodeStructure
- QuoteTags
- QuoteXML
- UnquoteXML
CompareStrings
Compare two given strings and return how much they are similar. Uses word based levenshtein comparison ratio. The $Coverage parameter defines how similar two words have to be to be rated as equal or as different. The Default value is 0.8 (80%). The returned $Percentage value is a float number between 0 and 1.0 which tells how similar the both supplied strings are.
Syntax |
$Percentage = CompareStrings($StringA, $StringB) |
Input |
|
Return |
|
ConvertNewlines
replace white spaces including newlines with a single space.
Syntax |
$OneLineString = ConvertNewlines($StringWithNewlines) |
Input |
|
Return |
|
DecodeStructure
Decodes all strings in a nestes array/hash structure with a given character encoding. The function creates a copy of the structure. The original structure is not changed.
Syntax |
$Structure = DecodeStructure( $Encoding, $EncodedStructure ) |
Example |
$Structure = DecodeStructure( 'iso-8859-1', $EncodedStructure ); |
Input |
|
Return |
|
EncodeNonISO1Chars
Syntax |
$Output = EncodeNonISO1Chars( $Input ); |
Example |
"& |
EncodeStructure
Encodes all strings in a nestes array/hash structure with a given character encoding. The function creates a copy of the structure. The original structure is not changed.
Syntax |
$EncodedStructure = EncodeStructure( $Encoding, $Structure ) |
Example |
$EncodedStructure = EncodeStructure( 'iso-8859-1', \%Structure ); |
Input |
|
Return |
|
QuoteTags
Replaces the special characters <and> by < and > respectively.
Syntax |
$Output = QuoteTags( $Input ); |
Example |
print QuoteTags( "<bigger>&</bigger>" ); |
Input |
|
Return |
|
QuoteXML
Replaces the special characters &"'<> by their corresponding XML entities.
Syntax |
$Output = QuoteXML( $Input ); |
Example |
print QuoteXML( "<bigger>&</bigger>" ); |
Input |
|
Return |
|
UnquoteXML
Replaces standard XML entities by the corresponding special characters.
Syntax |
$Output = UnquoteXML( $Input ); |
Input |
|
Return |
|