How to replace the last character in a string with VB6?

How to replace the last character in a string with VB6? I have syntax

Replace$(expression, find, replacewith[, start[, count[, compare]]]) 

but I can not find the correct use of this. I have something like

 iLength = Len(sBuild) sBuild = Replace(sBuild, "^", "ΓΊ", iLength, 1) 

This does not work, but I can not find examples on the Internet.

Thanks!

+6
source share
2 answers

Try

sBuild = Left$(sBuild, iLength - 1) & "ΓΊ"

+4
source

Another method is to use the Mid () keyword:

 Mid$(sBuild, Len(sBuild), 1) = "ΓΊ" 

This also has the advantage that you do not perform line reallocation / memory reallocation.

+9
source

Source: https://habr.com/ru/post/906223/


All Articles