Information générale
Titre:
Problems with incrementing strings
Hi.
I am trying to increment a string and am having problems, mostly to do
with the synstax of Int and Char functions.
I have a sring with two letters in it e.g. 'CF'
I want to 'Increment' the string by 1
e.g. Old string New string
CF CG
CZ DA etc
IN VFP I would do the following:
IF SUBSTR(MyString,2,1) = "Z"
MyString = CHR(ASC(SUBSTR(MyString,1,1)) + 1) + "A"
ELSE
MyString = SUBSTR(MyString,1,1) + CHR(ASC(SUBSTR(MyString,2,1)) + 1)
ENDIF
Any ideas on how to do this in .Net
(I've use a combinarion of Int and Char and Substr but am getting syntax errors)
regards,
Gerard
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement