Supprimer un caract. d'un String

mfritsch Messages postés 46 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 3 mai 2005 - 23 janv. 2005 à 14:26
mythic_kruger Messages postés 241 Date d'inscription jeudi 8 janvier 2004 Statut Membre Dernière intervention 10 novembre 2005 - 23 janv. 2005 à 22:30
Bonjour,

Comment on supprime le dernier caractère d'une variable String ?

Merci beaucoup d'avance,

Max

6 réponses

Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
23 janv. 2005 à 14:40
Dim s As String

s = "ABCDx"

MsgBox = Left$(s, Len(s) - 1)

Daniel
0
mfritsch Messages postés 46 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 3 mai 2005
23 janv. 2005 à 15:11
Merci beaucoup Daniel. Cependant VB m'affiche un message d'erreur lors de l'éxécution : "Un appel de fonction sur la partie gauche d'une affectation doit renvoyer un type Variant ou Object".

----------
Private Sub cmdBouton_Click()
Call viderTextBox

Dim s As String

s = "ABCDx"

MsgBox = Left$(s, Len(s) - 1)
End Sub
----------

Vous voyez ce qui cloche ?

Merci,

Max
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
23 janv. 2005 à 15:24
désolé j'avais remplacé Text1 pas MsgBox au dernier moment

Text1.Text = Left$(s, Len(s) - 1)
MsgBox Left$(s, Len(s) - 1)

Daniel
0
cs_BladeFrZn Messages postés 6 Date d'inscription lundi 27 octobre 2003 Statut Membre Dernière intervention 23 janvier 2005
23 janv. 2005 à 18:17
sinon tu peux faire

Dim test as string = ABCDx

test = replace(test,strings.right(test,1),"")

msgbox test

BladeFrZn (slipknot)
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mythic_kruger Messages postés 241 Date d'inscription jeudi 8 janvier 2004 Statut Membre Dernière intervention 10 novembre 2005
23 janv. 2005 à 22:29
lestring = Right(lestring, len(lestring)-1)
0
mythic_kruger Messages postés 241 Date d'inscription jeudi 8 janvier 2004 Statut Membre Dernière intervention 10 novembre 2005
23 janv. 2005 à 22:30
Fonction Left() pas Right() dsl
0
Rejoignez-nous