You are not logged in.

frankp

Beginner

  • "frankp" started this thread

Posts: 14

Date of registration: Jan 12th 2009

  • Send private message

1

Wednesday, January 14th 2009, 9:21am

MID statement

A question: I miss the mid[$] STATEMENT (not the function). Example:

mystring = "abcdef"

mid(mystring,3) = "5"

print mystring

[result] ab5def

How can I get around this without writing a sub from scratch? I can't understand how the Jabaco REPLACE function exactly works.

Thanks.

maXim

Trainee

  • "maXim" is male

Posts: 53

Date of registration: Jan 5th 2009

Location: Sesto Fiorentino, Florence (ITALY)

Occupation: design & development (HW, SW & FW)

Hobbies: chess, fly fishing, good wine and beautiful women!

  • Send private message

2

Thursday, January 15th 2009, 4:20pm

Hi frankp,

I have encountered the same problem. While waiting for the improvement and completion of the Mid function, I have resolved as follows:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..... 
..... 
Dim xStr 
..... 
xStr = "ABCDEFG" 
xStr = MidEx(xStr, 4, "H") 
MsgBox xStr 
..... 
..... 
Public Function MidEx(xString1 As String, xPosition As Integer, xString2) As String 
    Dim StrL As String 
    Dim StrR As String 
    If xString1 = "" Then xString1 = " " 
    If xPosition <= 0 Then xPosition = 1 
    StrL = Left(xString1, xPosition - 1) 
    StrR = Right(xString1, Len(xString1) - xPosition) 
    MidEx = StrL & xString2 & StrR 
End Function


... won't be the best solution but works! ;)

Best Regards,

maXim

This post has been edited 2 times, last edit by "maXim" (Jan 15th 2009, 7:45pm)


frankp

Beginner

  • "frankp" started this thread

Posts: 14

Date of registration: Jan 12th 2009

  • Send private message

3

Saturday, January 17th 2009, 8:57am

MID Statement

Simple but clever!

Many thanks!

frankp

Rate this thread
WoltLab Burning Board