2005. június 29., szerda

Grab two characters from a TEdit


Problem/Question/Abstract:

Assume the following entry in an edit box: '12-13-14-15-16'. Then, I would like to grab the '14' for example. I know that it is from position 7 to 8.

Answer:

This can be done with:

{ ... }
sTheChars := Copy(Edit1.Text, 7, 2);

7 = starting character's position (1 = first character)
2 = number of characters to copy

Nincsenek megjegyzések:

Megjegyzés küldése