Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

string

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!

like image 560
JimDel Avatar asked Jan 17 '12 18:01

JimDel


1 Answers

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.

like image 184
Deanna Avatar answered Nov 15 '22 06:11

Deanna