|
![]() |
||||||||||||||
Primitive Data Types TutorialReplace FunctionsWafl contains the following string replacing functions: strReplace : (String * String * String * Integer -> String) strReplaceAll : (String * String * String -> String) strReplaceAllI : (String * String * String -> String) strReplaceI : (String * String * String * Integer -> String) strLowerCase : (String -> String) strUpperCase : (String -> String) All strReplace functions compute the first specified string, while replacing appearance(s) of the second specified string by the third specified string. Original string remains unchanged. Functions, which names end with 'I', ignore the letter case in searching the second string. Function strReplace(s,p,x,i) returns string s with i-th appearance of sub string p replaced with string x. Function strReplaceAll(s,p,x) returns string s with all i-th appearances of sub string p replaced with string x. Function strLowerCase(s) returns string s with all upper case characters replaced with appropriate lower case characters. Function strUpperCase(s) returns string s with all lower case characters replaced with appropriate upper case characters. Source code:{# strReplace( 'abABabAB', 'a', '@', 2 ), strReplaceI( 'abABabAB', 'a', '@', 2 ), strReplaceAll( 'abABabAB', 'a', '@' ), strLowerCase( 'abABabAB' ), strUpperCase( 'abABabAB' ) #} Result:{# "abAB@bAB", "ab@BabAB", "@bAB@bAB", "abababab", "ABABABAB" #}
|
|
||||||||||||||
© 2006 Saša Malkov | |||||||||||||||