> juste une question, est-ce qu'il n'y a que le premier accent qui compte?
Dooooo!
Je propose donc un: Do While (lPos > 0) Mid$(sText, lPos, 1) = Mid$(REPLACEMENT_CHARSET, i, 1) lPos = InStr(sText, Mid$(ACCENTUATED_CHARSET, i, 1)) Loop
Ben correct! ;O)
Tout ça pour dire: ma fonction avec les api elle est mieux
> juste une question, est-ce qu'il n'y a que le premier accent qui compte?
Dooooo!
Je propose donc un:
Do While (lPos > 0)
Mid$(sText, lPos, 1) = Mid$(REPLACEMENT_CHARSET, i, 1)
lPos = InStr(sText, Mid$(ACCENTUATED_CHARSET, i, 1))
Loop
Ben correct! ;O)
Tout ça pour dire: ma fonction avec les api elle est mieux
> juste une question, est-ce qu'il n'y a que le premier accent qui compte?
Dooooo!
Je propose donc un: Do While (lPos > 0) Mid$(sText, lPos, 1) = Mid$(REPLACEMENT_CHARSET, i, 1) lPos = InStr(sText, Mid$(ACCENTUATED_CHARSET, i, 1)) Loop
Ben correct! ;O)
Tout ça pour dire: ma fonction avec les api elle est mieux
"François Picalausa" a écrit dans le message de news:
Hello,
J'peux y aller à coup d'APIs?
Private Declare Function LCMapString _ Lib "Kernel32" _ Alias "LCMapStringA" _ ( _ ByVal Locale As Long, _ ByVal dwMapFlags As Long, _ ByVal lpSrcStr As String, _ ByVal cchSrc As Long, _ ByVal lpDestStr As String, _ ByVal cchDest As Long _ ) _ As Long
Private Sub Command1_Click() MsgBox RemoveAccent("åãùêéè") End Sub
Private Function RemoveAccent(strIn As String) As String Dim DestString As String Dim DestSize As Long
DestSize = LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn), DestString, 0) If DestSize Then DestString = String$(DestSize, vbNullChar)
If LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn), DestString, DestSize) Then RemoveAccent = DestString End If End If End Function
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" a écrit dans le message de news:cdls0c$51$ > Bonjour, > > Je récupère une string qui doit être un futur nom de fichier php. Or, > les accents sont très mal gérés en php. > > Je voudrais donc remplacer les caractères accentués par leur homologue > non-accentué (é devient e, à devient a, etc). > > Existe-t-il une façon simple de faire cela ? > > Christian
Merci
Christian
"François Picalausa" <fpicalausa@chez.com> a écrit dans le message de
news:OmTx4y0bEHA.4032@TK2MSFTNGP11.phx.gbl...
Hello,
J'peux y aller à coup d'APIs?
Private Declare Function LCMapString _
Lib "Kernel32" _
Alias "LCMapStringA" _
( _
ByVal Locale As Long, _
ByVal dwMapFlags As Long, _
ByVal lpSrcStr As String, _
ByVal cchSrc As Long, _
ByVal lpDestStr As String, _
ByVal cchDest As Long _
) _
As Long
Private Sub Command1_Click()
MsgBox RemoveAccent("åãùêéè")
End Sub
Private Function RemoveAccent(strIn As String) As String
Dim DestString As String
Dim DestSize As Long
DestSize = LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn),
DestString, 0)
If DestSize Then
DestString = String$(DestSize, vbNullChar)
If LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn),
DestString, DestSize) Then
RemoveAccent = DestString
End If
End If
End Function
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" <c.hubert-hugoud@xtrem7.com> a écrit
dans le message de news:cdls0c$51$1@aphrodite.grec.isp.9tel.net
> Bonjour,
>
> Je récupère une string qui doit être un futur nom de fichier php. Or,
> les accents sont très mal gérés en php.
>
> Je voudrais donc remplacer les caractères accentués par leur homologue
> non-accentué (é devient e, à devient a, etc).
>
> Existe-t-il une façon simple de faire cela ?
>
> Christian
"François Picalausa" a écrit dans le message de news:
Hello,
J'peux y aller à coup d'APIs?
Private Declare Function LCMapString _ Lib "Kernel32" _ Alias "LCMapStringA" _ ( _ ByVal Locale As Long, _ ByVal dwMapFlags As Long, _ ByVal lpSrcStr As String, _ ByVal cchSrc As Long, _ ByVal lpDestStr As String, _ ByVal cchDest As Long _ ) _ As Long
Private Sub Command1_Click() MsgBox RemoveAccent("åãùêéè") End Sub
Private Function RemoveAccent(strIn As String) As String Dim DestString As String Dim DestSize As Long
DestSize = LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn), DestString, 0) If DestSize Then DestString = String$(DestSize, vbNullChar)
If LCMapString(0, NORM_IGNORENONSPACE, strIn, Len(strIn), DestString, DestSize) Then RemoveAccent = DestString End If End If End Function
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" a écrit dans le message de news:cdls0c$51$ > Bonjour, > > Je récupère une string qui doit être un futur nom de fichier php. Or, > les accents sont très mal gérés en php. > > Je voudrais donc remplacer les caractères accentués par leur homologue > non-accentué (é devient e, à devient a, etc). > > Existe-t-il une façon simple de faire cela ? > > Christian