Sub GaucheDroite()
MsgBox Left("abcdef", 3)
MsgBox Right("abcdef", 2)
End Sub
Sub MilieuChaine()
MsgBox Mid("abcde", 3, 2) ' renvoie cd
MsgBox Mid("abcde", 3, 10) ' renvoie cde
MsgBox Mid("abcde", 10, 3) ' renvoie une cha�ne nulle
End Sub
Sub FonctionInStr()
' Exemple 1 : X contiendra 2
MsgBox InStr("abc", "b")
' Exemple 2 : X contiendra 0
MsgBox InStr("abc", "B")
' Exemple 3 : X contiendra 2
MsgBox InStr("abc", "bc")
' Si dans la section General/Declarations, on �crit Option Compare Text,
on peut comparer avec succ�s les minuscules et les majuscules. Si par contre
on �crit Option
' Compare Binary (option par d�faut), les caract�res ASCII sont purement
compar�s.
' Mais, on peut avoir Option Compare Binary, et malgr� tout, exceptionnellement
demander une comparaison de texte avec :
MsgBox InStr(0, "abc", "B", 1)
End Sub
Sub FonctionChr()
MsgBox Chr("a") ' renvoie 97 (code ASCII de a)
End Sub
Sub LongueurChaine()
MsgBox Len("abc") ' renvoie 3 (lettres)
End Sub
Sub MajusculeMinuscule()
MsgBox UCase("textE") ' renvoie TEXTE
MsgBox UCase("t�xte") ' renvoie T�XTE
MsgBox LCase("TExte") ' renvoie texte
End Sub
Sub FonctionVal()
MsgBox Val(" 21x") ' renvoie 21
MsgBox Val("x21") ' renvoie 0
MsgBox Val(21) ' donne une erreur (le param�tre doit�tre une cha�ne de
caract�res)
End Sub