简体   繁体   中英

How do I replace the last character in a string with VB6?

How do I replace the last character in a string with VB6? I've got the syntax

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

but I can't seem to find the right use of it. I've got something like

iLength = Len(sBuild)
sBuild = Replace(sBuild, "^", "ú", iLength, 1)

This isn't working but I can't seem to find any examples online.

Thanks!

Another method is to use the Mid() keyword:

Mid$(sBuild, Len(sBuild), 1) = "ú"

This also has the advantage of not doing string concatenation/memory reallocation.

尝试

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM