Copy
For example: str: = "123456"; str1: = Copy (str,2,3); As a result str1 equals 234. Copy has 3 parameters, the first is the string you want to handle, the second is the start position you want to intercept, and the 3rd is the number of bits to intercept. When your 3rd argument is greater than the character length, the effect is to take all the characters from the start position. STR1: = Copy (str,2,10); The result is that str1 equals 23456.
Leftstr and POS
Suppose the string is S: = ' Delphi is the best ', then
Leftstr (S, 5): = ' Delph '//s first 5 characters
Midstr (S, 6, 7): = ' i-is-th '//That is, the sixth bit of S starts after 7 characters (-:= spaces)
Rightstr (S, 6): = ' e-best '//is the character after S (-:= space)
Remove the first occurrence of a substring in the parent string
For example
POS (' B ', ' ABCD ');
The return result is 2//pos, which is the display B in the entire character.
Delete
Liezi:
Var
s:string;
Begin
S: = ' 12345 ';
Delete (S, 2, 2);
ShowMessage (S);//display 145 deletes 23. That is, delete the second bit of S from the beginning of the 2 characters.
End
The use of Copy,delete,pos and Leftstr,rightstr in Delphi