These are the built-in string functions available to use within the pmpolicy file.
Name | Description |
---|---|
match | Match a string to a pattern. |
Return a new string at a specified character length. | |
strindex | Return the position of a substring in a string. |
strlen | Return the length of a string. |
strsub | Return a substring of a string. |
Return a new string with specified replacements. | |
subst | Substitute part of a string. |
Return a substring of a string . |
int match( string regularexpr, string str )
match compares a string to a regular expression.
Returns true if a match is found; otherwise, false.
# check if user begins with j and ends with t… if (match("^j.*t$", user) ) { … }
int pad ( string sourcestring, string length, string padchar )
pad returns a new string at the exact length of characters long. The beginning of the string is the sourcestring.
If the length argument is bigger than the size of the sourcestring, then the returned string is padded with the padchar argument. Otherwise, the first length characters of sourcestring are returned.
The padchar argument can also contain multiple characters, in which case the characters return padded repeatedly.
result = pad("123",5," "); {
# returns "123"
}
result = pad("123",6,"<>"); {
# returns "123<><"
}
result = pad("User Name", 3, " "); {
# returns "User"
}
int strindex( string str, string substr )
strindex returns the numerical offset of a given string within another string. If the substr is not found, it returns -1.
printf("%d\n",strindex("xxxfooxxx","foo"));
Returns: "3"
printf("%d\n",strindex("xxxfooxxx","bar"));
Returns: "-1"
© 2024 One Identity LLC. ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center