DWStrShrinkfunction
Shrinks a string to use a consistent single character delimiter.
Syntax
FUNCTION DWStrShrink(BYREF wszSourceString AS CONST WSTRING, BYREF wszMask AS CONST WSTRING = "", BYVAL IgnoreCase AS LONG = TRUE) AS DWSTRING
Parameters
| Name | Description | |
|---|---|---|
wszSourceString | The main string. | |
wszMask | One or more character delimiters to shrink. | |
IgnoreCase | Boolean. If False, the search is case-sensitive; otherwise, it is case-insensitive. |
Description
Shrinks a string to use a consistent single character delimiter.
Remarks
This function creates a string with consecutive words separated by a consistent single character, making it easier to parse. If wszMask is not specified, all leading and trailing spaces are removed and all occurrences of two or more spaces are changed to a single space. If wszMask contains one or more characters to shrink, all the leading and trailing occurences of them are removes and all occurrences of one or more characters of the mask are replaced with the first character of the mask.
Example
DIM dws AS DWSTRING = DWStrShrink(",,, one , two three, four,", " ,") ' Output: "one two three four".
Reference
- Include file
DWSTRProcs.inc - Defined in AfxNova/DWStrProcs.inc:827
- Documented in String Management/DWString Procedures.md
- Topic: String Procedures