JCL Help:StrNPos@AnsiString@AnsiString@SizeInt

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Returns the position of the N-th occurence of a sub-string within a string.


Pascal

 function StrNPos(const S: string; const SubStr: string; N: SizeInt): SizeInt;
function StrNPos(const S: AnsiString; const SubStr: AnsiString; N: SizeInt): SizeInt;


Parameters

Parameters Description
const S: string The string in which to search for N occurences of SubStr.
const SubStr: string The sub-string to search for.
Index The number of occurences of sub-string in S.


Return Value

Index into S where the N-th occurence of SubStr is located. If SubStr has less than N occurences in S the result is 0.


Description

StrNPos returns the index into S of the N-th occurence of the specified sub-string. This function is case-sensitive and does not work with multibyte character sets. If the specified sub-string does not have N occurence in S the function returns 0.


See Also

StrNIPos


About

Unit

JclAnsiStrings


Donator

Team JCL


Notes

This function was inspired by code submitted by George Tasker


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page